I know how to create an AutoHotkey script to switch to (say) a Firefox window.

But suppose I have a number of Firefox windows open. I would like the key to switch to the next window each time it is pressed.

Edit - firefox was just an example. It could be PuTTY windows I wanted.

  • My answer would still function for any other window, too.
    – Phoshi
    Apr 2 '10 at 20:05
  • Agree @Phoshi - but the other answer was specific to Firefox
    – justintime
    Apr 2 '10 at 20:11

Try the WinActivateBottom command instead of WinActivate.

This activates the LEAST recently used window - and seeing as when you activate that, it's no longer the least recently used, this can be used to loop through every window.

; This hotkey WIN+A allows you to visit all open Firefox windows in order from oldest to newest:
SetTitleMatchMode, 2
WinActivateBottom, - Mozilla Firefox
  • 1
    Interesting idea. My feeling is the one at the bottom is likely to be the least interesting window to go to.
    – justintime
    Apr 2 '10 at 20:09
  • @justintime: Very likely. You could also use WinGet to retrieve a list of windows, and then do with that what you will - but I've not used that myself.
    – Phoshi
    Apr 2 '10 at 20:15
  • 1
    I have taken you answer as a starting point. If you are already on a n active Firefox window send it to bottom and then go to what is now the top.
    – justintime
    Apr 2 '10 at 20:30
  • @justintime Can you share that script?
    – Noumenon
    Jan 23 '19 at 23:44

If the reason you're trying to make an AutoHotkey script for this is simply because you don't think that functionality is available by default, then you may want to look at my post over at Windows Shortcut/Utility to switch between application windows. This functionality is actually already baked into Windows 7 and 8.


Here's how this can be done.

  1. get active window title and class.
  2. get a list of all windows of that class.
  3. switch to the next window in that list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.