1.
myWinTitle := "ahk_pid 15244" The pid looks suspicious, because the pid is usually related to each time the os executes the program, you try to close `.exe` and then open a new one, grab its pid to see , I don't think it's the `15244` you hardcoded in the script, suggest use
https://www.autohotkey.com/docs/v1/lib/WinGetTitle.htm
2.
ControlFocus,, %wintitle looks a bit suspicious. In the script you attached, I didn’t see the variable named
wintitle. did you mean
myWinTitle
Code: Select all
#UseHook
Pause on
; myWinTitle := "ahk_pid 15244"
Loop {
WinGetTitle, myWinTitle , % "ahk_exe gmod.exe"
ControlFocus,, %myWinTitle%
/*
if (ErrorLevel = 1)
MsgBox % "can't find wintitle, wintitle is `n" wintitle
*/
ControlSend,,{e down}, %myWinTitle%
sleep 100
}
Shift & g::Pause