Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

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:
#a::
SetTitleMatchMode, 2
WinActivateBottom, - Mozilla Firefox
return
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

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

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

Your Answer

 
discard

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.