Still having problems.
This works on every emulator I have except mame.
It is watching for both left and right keys being pressed and held.
It should send esc, to exit the emulator, or screen saver if its on, then V to exit mala.
I use V to exit mala so I can go into the PC from the keyboard, if needed.
When I run it within mame, it does not exit mame, but it does shutdown after all the delays.
Mala does not get updated. (Selected emulator and game to display on next run).
im sure it has something to do with mame taking the focus?
id appreciate any help.
#SingleInstance Force ;If this script is already running, do not restart it
k1name := "left" ; key 1
k2name := "right" ; key 2
loop
{
sleep 1500 ; milliseconds sleep to reduce CPU usage
k1 := getkeystate(k1name, "P") ; get key 1 state getkeystate(k1name, "P")
k2 := getkeystate(k2name, "P") ; get key 2 state
{
if ( k1 & k2 & !trig )
{
trig := 1 ; set flag to avoid repetition
SetKeyDelay 500
Send, {Esc}
Sleep 750
SetKeyDelay 250
Send, {v}
Sleep 5000 ;Pause to allow mala to close
;put in windows ahutdown here.
Shutdown 12
;A combination (sum) of the following numbers:
;0 = Logoff
;1 = Shutdown
;2 = Reboot
;4 = Force
;8 = Power down
;Add the required values together.
}
if ( !k1 & !k2 ) ;( !k1 || !k2 )
{
trig := 0
}
}
}