how to turn off computer using ESC key

djtoshi182's icon

hello.

I will make my patch running automatically as the computer boots,
I also want the user press ESC key to turn off the computer, as normal as possible.
I don't want it to be forced shutdown.

thx.

$Adam's icon

You could experiment with launching a shell script (using the shell object) which contains a shutdown command. However, I've never tried it.

HTH,
Ádám

kjelgaard's icon

You will likely have a much easier time doing this with the free trial of Controllermate.

LSka's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Presuming you're working on a Mac:

on windows you can send the shutdown /s command via the mxj class

Jdudeo's icon

If you're on windows it might be easiest to use Auto Hot Key
http://www.autohotkey.com/

vichug's icon

[OT sorry] mmmm by the way, anyone knows if it is possible to easily disable the windows key, in windows ?

D.Singer's icon

Hey LSKA,

Could you drop off some example? I am also in the need of PC control via max, and project must to be in windows OS...
Unfortunately, mxj object is very poorly documented, reference do not says much, and I cannot find java-doc to read more about it...

What kind of class in mxj should be use to execute shutdown /s command?

Many thanks!

Ernest's icon

I agree with jdudeo, autohotkey is the way to go.

D.Singer's icon

Hey to everyone who reads this thread

I found a nice solution to shutdown, restart or hibernate your pc from max.
Process is pretty simple.

First you need to create link with setting to shutdown your pc.
Here are link, that explains how to do it in different versions of windows.
http://www.computerhope.com/issues/ch000321.htm

After that you need to set in Max to run this link via message box.

; max launchbrowser yourlink.lnk

for example: ; max launchbrowser C:/User/me/Desktop/shutdown.lnk

once you click it, max will launch link, which triggers system to shutdown.
You can even use ; max quit then shutdown by using trigger b b, first quits max, then shutdown pc, or set it to ESC button or anything you like.

Hope this will help someone.