i managed to get everything working with that script before except mame. im using a serial command to change my Gun4IR settings upon mame launch, but that command seems to stop the ahk from refocusing on mame. this is my current code in the running autohotkey section. It closes and accomplishes everything except regaining focu
Esc::
Run, %COMSPEC% /C echo M3.0 > COM3
Process,Close,Mame.exe
Run,taskkill /im "Mame.exe" /F
if WinExist("LaunchBox Game Startup")
{
WinActivate
WinWaitClose, LaunchBox Game Startup
}
if WinExist("LaunchBox")
{
WinActivate
}
if WinExist("LaunchBox Big Box")
{
WinActivate
}
ExitApp