Forums > MaxMSP

Max shutting down the computer

March 5, 2009 | 12:53 pm

Hi,

Currently I’m working on an installation that needs to be switched off from a maincomputer using midi. Is there a way, and what’s the most reliable, to do this in Max5/Leopard/MiniMac?

Thanks,
poul


March 5, 2009 | 1:22 pm
poul wrote on Thu, 05 March 2009 05:53
Hi,
Is there a way, and what’s the most reliable, to do this in Max5/Leopard/MiniMac?

You could try the aka.shell object – the easiest way might be a short applescript that performs the shutdown operation – otherwise I think you need to be the superuser (to do it directly through terminal commands).

The command to the shell would be something like:

osascript -e ‘tell application "System Events" to "shut down"‘

Although, I haven’t tested this particular script. Note that if there are any unsaved documents etc. then I don’t think the computer will actually shutdown (as in the case of choosing shutdown manually)

regards

Alex


March 5, 2009 | 2:10 pm

During my research I found aka.shell but it’s for Max 4…


March 5, 2009 | 2:19 pm
AlexHarker wrote on Thu, 05 March 2009 14:22
Although, I haven’t tested this particular script. Note that if there are any unsaved documents etc. then I don’t think the computer will actually shutdown (as in the case of choosing shutdown manually)

Using "shutdown -h now" as superuser, the shutdown procedure won’t be stopped if there are unsaved documents.
Poul, beside [aka.shell], there is also [shell]:
http://www.cycling74.com/twiki/bin/view/Share/JeremyBernstein

p


March 5, 2009 | 2:24 pm
poul wrote on Thu, 05 March 2009 07:10
During my research I found aka.shell but it’s for Max 4…

Most objects do not require specific max 5 versions.

I am able to run aka.shell here under 5 (just using the test file) and it seems to work – unless you have a good reason for believing it is not compatible with max 5 then I’d assume that it is until you find otherwise.

Alex


March 5, 2009 | 2:27 pm
Patrick Delges wrote on Thu, 05 March 2009 07:19
http://www.cycling74.com/twiki/bin/view/Share/JeremyBernstein

Looking there – Have you looked at the curtains object? (again – I’d just try the 4.6 version and if it works it works. Generally UI objects and objects doing things with files are the only ones which needed to be changed to work in max 5).

A.


March 5, 2009 | 2:56 pm

Actually, I’d recommend looking into Keep-It-Up for this. Aside from setting automated startup/shutdown times, it will restart your Max patch in case it crashes, keep logs, send you emails with status updates on how your patch is running, and a bunch more stuff.

If the shutdown is to be triggered remotely by MIDI, you can have your Max patch trigger an AScript (with aid either of aka or taptools) or other message to KIU to execute the actual shutdown.

I have no interest in KIU other than as a satisfied user. Last time I looked it cost US$22.


March 5, 2009 | 7:00 pm

Ok, thanks, but I still didn’t get it working.. What commandline exactly do I have to send to aka.shell?

So far I tried:

shutdown -h now
‘shutdown -h now’
osascript -e ‘shutdown -h now’
do shell script ‘shutdown -h now’

all routed through a [tosymbol] object, but all I get are "aka.shell: no result’ messages in the maxwindow.

poul


March 5, 2009 | 8:08 pm

I already solved it by executing an applescript.app from my patch.
Maybe not the most efficient way but it works fine!


Viewing 9 posts - 1 through 9 (of 9 total)