Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: SlainbytheBrain on June 29, 2011, 03:45:39 am
-
I am trying to use Autohotkey to shutdown my computer with my arcade joystick. The button combination I want to use is pressing 1, 2, and 4 simultaneously.
I tried the following:
124::Shutdown 9
When trying to run the script, I was told that this was an invalid hotkey. What am I missing?
Thanks,
Matt
-
You can only use one hotkey such as
1::
shutdown, 9
return
or two hotkeys such as
1 & 2::
shutdown, 9
return
where 1 acts as a shift key.
However, here's a work around I cooked up:
$1::
send 1
KeyWait, 2, D T1
If (ErrorLevel = 0)
{
Keywait, 4, D T1
If (ErrorLevel = 0)
{
shutdown, 9
}
}
return
This works, but note that it has a couple of side effects - when you press 1, the 1 key is disabled for a second afterwards. This shouldn't be a problem if 1 is being used as a start button. Otherwise, you may wish to switch the keys around so that 2 or 4 is the hotkey. Also, this will also be activated if you pressed 1 then 2 then 4 fairly quickly, but assuming these aren't all "action" buttons, that's unlikely to happen by accident.
-
And for the maccies out there: just program your minipac to have "eject" on one button. Ctrl-eject is immediate shut down on a mac.
-
You can only use one hotkey such as
1::
shutdown, 9
return
or two hotkeys such as
1 & 2::
shutdown, 9
return
where 1 acts as a shift key.
However, here's a work around I cooked up:
$1::
send 1
KeyWait, 2, D T1
If (ErrorLevel = 0)
{
Keywait, 4, D T1
If (ErrorLevel = 0)
{
shutdown, 9
}
}
return
This works, but note that it has a couple of side effects - when you press 1, the 1 key is disabled for a second afterwards. This shouldn't be a problem if 1 is being used as a start button. Otherwise, you may wish to switch the keys around so that 2 or 4 is the hotkey. Also, this will also be activated if you pressed 1 then 2 then 4 fairly quickly, but assuming these aren't all "action" buttons, that's unlikely to happen by accident.
Thanks for cooking that up, but it does not seem to be working for me. I copied that into a notepad file with .ahk at the end and ran it. It is showing up in the taskbar but pressing 1, 2, and 4 does not initiate shutdown regardless of speed of pressing or order or if all pressed simultaneously. Is there something simple I could be missing here?
-
Hmm, works fine for me, though I admit I did not test this exact script because I didn't want to shutdown my computer. ;) I tested this one
$1::
send 1
KeyWait, 2, D T1
If (ErrorLevel = 0)
{
Keywait, 4, D T1
If (ErrorLevel = 0)
{
msgbox It works!
}
}
return
which is exactly the same as the other one except it should display a popup box saying "It works!" instead of shutting down your computer. Give this one a try and see if you get the popup box. Just to make sure the problem isn't that your computer isn't responding to autohotkey's shutdown command for some reason.
-
I got it to work. Thanks. I was adding it into an existing autohotkey text file when it was not working. Creating a separate text document specifically for that script was the ticket. Still new to this stuff!
Thanks again!