Max shutting down the computer
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?
|poul wrote on Thu, 05 March 2009 05:53|
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)
During my research I found aka.shell but it’s for Max 4…
|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]:
|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.
|Patrick Delges wrote on Thu, 05 March 2009 07:19|
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).
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.
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.
I already solved it by executing an applescript.app from my patch.
Maybe not the most efficient way but it works fine!