Created
February 20, 2025 08:53
-
-
Save Navidda/4a613e17bb376188b74ef6f5e3e7a218 to your computer and use it in GitHub Desktop.
AHK (v1) script to switch between windows of the same application in Windows 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!`:: | |
WinGet, ActiveProcessName, ProcessName, A | |
WinGetClass, OldClass, A | |
WinGet, WindowList, List, ahk_exe %ActiveProcessName% | |
if (WindowList > 1) { | |
Loop, %WindowList% { | |
this_id := WindowList%A_Index% | |
WinGetClass, NewClass, ahk_id %this_id% | |
; Skip if it's the same as the currently active window | |
if (WinActive("ahk_id " this_id)) | |
continue | |
; Focus on the new window if it matches the criteria | |
if (OldClass <> "CabinetWClass" or NewClass = "CabinetWClass") { | |
WinActivate, ahk_id %this_id% | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment