I'm trying to get ControlSend to work so that keyboard keys are pressed when my .exe is not selected (not in foreground) but whatever I try, the script stops working if I click away from the exe
This is what I have:
Code: Select all
ControlSend,,my.exe
#Persistent
SetTimer, PressTheKey, 500
Return
#o::Pause ;
IfWinActive, my.exe
PressTheKey:
if (WinActive("ahk_exe my.exe"))
{
Send, {space down}
Send, {F4 down}
Sleep 10
Send, {F4 up}
Send, {z down}
Sleep 10
Send, {z up}
}
Return