#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #NoTrayIcon #Persistent ES_DISPLAY_REQUIRED ::= 0x00000002 SetTimer, CheckWindowsState, % 1000*30 ; Poll every 30 seconds CheckWindowsState: If ( WinActive("ahk_class AGFullScreenWinClass") || WinActive("ahk_class ShockwaveFlashFullScreen") ) { DllCall("SetThreadExecutionState", UInt, ES_DISPLAY_REQUIRED) ;prevent sleep } Return