From AHK Forum search:
http://www.autohotkey.com/forum/topic42313.html&highlight=detect+full+screen+mode
animeaime's post in the thread
Ok. This should. I remember how NiftyWindows would always suspend on a full screen program. So, this should do the job. Use WinExist (or some other means) to get the Unique ID (HWND) of the desired window.
isWindowFullScreen(WinID)
{
;checks if the specified window is full screen
;code from NiftyWindows source
;(with only slight modification)
;use WinExist of another means to get the Unique ID (HWND) of the desired window
if ( !WinID )
return
WinGet, WinMinMax, MinMax, ahk_id %WinID%
WinGetPos, WinX, WinY, WinW, WinH, ahk_id %WinID%
if (WinMinMax = 0) && (WinX = 0) && (WinY = 0) && (WinW = A_ScreenWidth) && (WinH = A_ScreenHeight)
{
WinGetClass, WinClass, ahk_id %WinID%
WinGet, WinProcessName, ProcessName, ahk_id %WinID%
SplitPath, WinProcessName, , , WinProcessExt
if (WinClass != "Progman") && (WinProcessExt != "scr")
{
;program is full-screen
return true
}
}
}
edit: I haven't tried it but according to the help you can get the handle of the active window like this: WinExist("A")
so isWindowFullScreen(WinExist("A")) should return true if the active "window" is in full screen mode. At least for single monitor systems anyway.
If it returns true just Send the !{Enter}. If not just eat the key combo.
!Enter::
If isWindowFullScreen(WinExist("A"))
Send, !{Enter}
else
; send something else or just eat the keys
return