Skip to content

Instantly share code, notes, and snippets.

@CFelipezapata
Last active July 3, 2025 22:24
Show Gist options
  • Select an option

  • Save CFelipezapata/f7563d364197936a6673d28ad53b01dc to your computer and use it in GitHub Desktop.

Select an option

Save CFelipezapata/f7563d364197936a6673d28ad53b01dc to your computer and use it in GitHub Desktop.
AHK V2 Script to switch between windows of the same app for autohotkey, like macOS
; ahk V2
; Source: https://gist.github.com/CFelipezapata/f7563d364197936a6673d28ad53b01dc
; Alt + ` : Cycle between windows of the same app (like macOS)
!`::{
activeProcess := WinGetProcessName("A")
winList := WinGetList("ahk_exe " activeProcess)
if winList.Length > 1 {
; Activate the last window in the stack (most recently used *other* one)
WinActivate("ahk_id " winList[winList.Length])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment