followthereaper
07-28-2011, 01:56 AM
Hey there, want to exit your emulator through your joypad (ie: 360 controller) but don't want to do it accidentally? I've had a heck of a time figuring this out but finally found a solution online.
Joy1:: ; This can be any *one* of the four buttons.
Loop
{
GetKeyState, JoyTrigger, %A_ThisHotkey%
if JoyTrigger = U ; Main button released before the others were pressed.
return ; End this thread to start waiting again for a new triggering.
GetKeyState, JoyState2, Joy2 ; Replace these digits with your chosen buttons.
GetKeyState, JoyState3, Joy3
GetKeyState, JoyState4, Joy4
JoyStates = %JoyState2%%JoyState3%%JoyState4%
if JoyStates = DDD ; The other three are all down now, so break out of the loop.
break
else ; Keep waiting, but do a Sleep to prevent heavy load on CPU:
Sleep, 10
}
; Since the loop above didn't "return", all four buttons are now down.
Send {Esc}
return
Have fun! I hope I helped out someone as I've needed way too much help getting this program to work (that and xbmc).
Source: autohotkey (DOT) com/forum/topic1556 (DOT) html
Joy1:: ; This can be any *one* of the four buttons.
Loop
{
GetKeyState, JoyTrigger, %A_ThisHotkey%
if JoyTrigger = U ; Main button released before the others were pressed.
return ; End this thread to start waiting again for a new triggering.
GetKeyState, JoyState2, Joy2 ; Replace these digits with your chosen buttons.
GetKeyState, JoyState3, Joy3
GetKeyState, JoyState4, Joy4
JoyStates = %JoyState2%%JoyState3%%JoyState4%
if JoyStates = DDD ; The other three are all down now, so break out of the loop.
break
else ; Keep waiting, but do a Sleep to prevent heavy load on CPU:
Sleep, 10
}
; Since the loop above didn't "return", all four buttons are now down.
Send {Esc}
return
Have fun! I hope I helped out someone as I've needed way too much help getting this program to work (that and xbmc).
Source: autohotkey (DOT) com/forum/topic1556 (DOT) html