Skip to content

Instantly share code, notes, and snippets.

@rbika
Last active July 5, 2024 04:33
Show Gist options
  • Save rbika/014fb3570beaef195db0bd53fa681037 to your computer and use it in GitHub Desktop.
Save rbika/014fb3570beaef195db0bd53fa681037 to your computer and use it in GitHub Desktop.
AutoHotKey script to cycle between windows of the same app
; Cycle between windows of the same app like in macOS - Alt+backtick.
; Source: https://gist.github.com/rbika/014fb3570beaef195db0bd53fa681037
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
!`::
WinGet, activeProcess, ProcessName, A ; Retrieves the name of the process that owns the active window
WinGet, winList, List, ahk_exe %activeProcess% ; Retrieves a pseudo-list of windows belonging to this process
WinActivate, % "ahk_id " winList%winList% ; Activates the last window in the stack
return
; Limitations
; • It does not work in Explorer app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment