Skip to content

Instantly share code, notes, and snippets.

@jorgepsmatos
Created September 2, 2024 17:45
Show Gist options
  • Save jorgepsmatos/2cef9b836553d7619e89ad143a305f4f to your computer and use it in GitHub Desktop.
Save jorgepsmatos/2cef9b836553d7619e89ad143a305f4f to your computer and use it in GitHub Desktop.
loopwindows.ahk
#Persistent
Toggle := false ; Initialize the toggle state to "off"
Return
^!t:: ; Hotkey: Ctrl + Alt + T
Toggle := !Toggle ; Toggle the state (on/off)
If (Toggle)
{
SetTimer, LoopWindows, 6000 ; Start the timer
}
Else
{
SetTimer, LoopWindows, Off ; Stop the timer
}
Return
; https://www.autohotkey.com/boards/viewtopic.php?style=17&t=97103
LoopWindows()
{
win := []
WinGet, wins, List
Loop, %wins% {
WinGetTitle, ttitle, % winTitle := "ahk_id " wins%A_Index%
WinGet, proc, ProcessName, %winTitle%
WinGetClass, class, %winTitle%
If (ttitle > "" && (ttitle != "Program Manager" || proc != "Explorer.EXE") && class != "#32770")
win.Push(wins%A_Index%)
}
WinActivate, % "ahk_id " win[win.Count()]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment