Monday, September 25, 2023

Script for auto minimizing window when focus lost

#NoEnv
#Warn
var := true
SetTimer, subroutine, -1
return

subroutine:
WinWaitNotActive, ahk_exe winword.exe
sleep, 1000     
if (var) {
    WinMinimize
    SetTimer, subroutine, -1
}
return

!t::SetTimer, subroutine, % (var:=not var) ? -1 : "Off"
!x::ExitApp ; ALT+X terminates the script

No comments: