cycleWindow.ahk

Allows user to tab through a narrow subset of windows, as one would alt-tab through the set of all visible windows, or open a new window.

cycleWindow Version: 1.0

AutoHotkey Version: 1.0.48.05

Platform: Win9x/NT

Author: Jon Smithers

Summary
cycleWindow.ahkAllows user to tab through a narrow subset of windows, as one would alt-tab through the set of all visible windows, or open a new window.
The Function
cycleWindowAllows user to tab through a narrow subset of windows, as one would alt-tab through the set of all visible windows, or open a new window.
Examples

The Function

cycleWindow

cycleWindow(title,  
regExp = "(.*)",
pathToRun = "")

Allows user to tab through a narrow subset of windows, as one would alt-tab through the set of all visible windows, or open a new window.

Parameters

titleThe function searches for windows with this title.  For example, you would put “Notepad” to find all notepad windows (as they contain “Notepad” in their title).  Note that this doesn’t necessarily specify the window title per say.  It could be something like “ahk_class CabinetWClass”.
regExpA regular expression that describes how to display each window title in the listview (“title” not related to above parameter).  The listview will display only the first group in the regular expression.  Leaving it blank, or specifying “” will cause the window titles to be displayed as they are (“(.*)”).  Specify “0” to not display the listview at all.  This parameter is useful becaues you may not want to see the “ - Google Chrome” at the end of every Chrome window title.  Specifying “(.*) - Google Chrome” here will trim that out.  For more info on regular expressions, see http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm.
pathToRunThe path used to open a new window if necessary.

SETTINGS

A few easily-changeable tweaks that affect how the function acts.

These can be found in the beginning lines of the function in cycleWindow.ahk.  If you want these settings to differ between various calls of cycleWindow, you can add them as optional parameters to cycleWindow.

cycleWindow_UseThumbnailsIf you have Windows Vista or later, you can use window thumbnails.  This is a nice way to show a window without having to actually activate it.  This is the preferred way, but you need maul.esel’s library from http://www.autohotkey.com/forum/viewtopic.php?t=70839.
cycleWindow_thumbnailColorThumbnails are displayed on a GUI.  This GUI, which is underneath the thumbnails, can be transparent or opaque.  If you are using Aero (so the borders of your windows are transparent), having a colored GUI behind the thumbnails creates a nice highlighting effect.  Specify the color of the highlight in this setting.  To disable highlight, set it to “0” (this might be desirable if you don’t use aero transparency).
cycleWindow_thumbnailBorderThumbnails are displayed on a GUI.  This displays how many pixels the GUI should extend out from behind the thumbnail, to create a border.  If you are using Aero, the highlighting effect should be enough, so set this to 0.
cycleWindow_disableThumbFadeDisables the highlight-fading that occurs when your release your finger from the holdkey (e.g.  CapsLock).  This feature uses the only global variable in cycleWindow.
cycleWindow_ListViewGUIThe GUI number (1-99) that will be used to create the ListView which shows the window titles.
cycleWindow_ThumbnailGUIThe GUI number (1-99) that will be used to create the windows’ thumbnails (if cycleWindow_UseThumbnails is set to true).
cycleWindow_matchModeTitleMatchMode.  Used with AHK’s SetTitleMatchMode (http://www.autohotkey.com/docs/commands/SetTitleMatchMode.htm) to set how windows are to be searched with the title parameter.  It has been set to 2, meaning that if a window contains title’s text anywhere in its title, it is considered a match.
cycleWindow_NewWindowKeyIf this key is held down when you press the cycle key, the function launches a new window by running the path of the parameter pathToRun.  It is set initially to “LWin”.
cycleWindow_shrinkThumbKeep it set to false.  This was an idea I chose not to fully implement.

Examples

CapsLock & e::cycleWindow("ahk_class CabinetWClass","(.*)", "C:\Users\Jon\School\Fall11") ;Windows Explorer
CapsLock & n::cycleWindow("Notepad2","(.*) - Notepad2", "C:\Program Files (x86)\1-Utilities\Notepad2 AHK\Notepad2(AHK).exe")
CapsLock & i::cycleWindow("- Google Chrome","(.*) - Google Chrome", "C:\Users\Jon\AppData\Local\Google\Chrome\Application\chrome.exe")
CapsLock & v::cycleWindow("VLC media player", "(.*) - VLC media player", "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe")
cycleWindow(title,  
regExp = "(.*)",
pathToRun = "")
Allows user to tab through a narrow subset of windows, as one would alt-tab through the set of all visible windows, or open a new window.
Close