Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 5 down vote accepted

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
share|improve this answer
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
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

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.
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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