Allows user to tab through a narrowed subset of windows, as one would alt-tab through the set of all visible windows, or open a new window by launching a path, all in a single hotkey.
Requires maul.esel’s library “Thumbnail Lib.ahk” (http://www.autohotkey.net
cycleWindow Version: 1.22
Forum Link: http://www.autohotkey.com
Author: Jon Smithers
AutoHotkey Version: 1.0.48.05
Platform: Windows Vista, Windows 7
| cycleWindow.ahk | Allows user to tab through a narrowed subset of windows, as one would alt-tab through the set of all visible windows, or open a new window by launching a path, all in a single hotkey. |
| Functions | |
| cycleWindow | Cycles through a subset of windows or launches a path. |
| cycleCurrentWindow | Cycles through windows of the same class as the currently active window. |
| Examples | |
| Changes |
cycleWindow( title = "", regExp = "([^-]*).*", pathToRun = "" )
Cycles through a subset of windows or launches a path.
| title | Determines which windows will be included in the subset. This can be a title, like “Notepad”, or something like “ahk_class CabinetWClass”. Windows without a title are automatically removed. If this parameter is blank, the subset will include all windows, except those with blank titles, the Start Button window, as well as the bottom window, which is always “Program Manager”. You can also employ a much more complicated and flexible method of determining the subset by putting “|” as the first character. See the “Inclusion/Exclusion” section below. |
| regExp | A regular expression that describes how to trim the title of each window in the subset for display in the ListView. The listview will display only the first group in the regular expression. By default, regExp is “([^-]*).*”. Simply putting “” will yield the same result. Specify the regular expression “(.*)” to not trim anything from the title. Specify “0” to not display the ListView at all. This parameter is useful because you may not want to see (for example) 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 |
| pathToRun | The path used to open a new window in the case that no existing windows currently match the criteria to be in the subset, or in the case that you are holding the “cycleWindow_NewWindowKey” (which is initially set to “LWin”) when the hotkey is pressed. |
This is a mode where cycleWindow uses a much more flexible and complex method of determing the subset. To use inclusions/exclusions, the first character of the title parameter must be “|”.
| Format | ”| includeCriteria_1, includeCriteria_2, ..., includeCriteria_X | excludeCriteria_1, excludeCriteria_2, ..., excludeCriteria_Y “ |
The comma-separated list after the first “|” comprises the Inclusions. The comma-separated list after the second “|” comprises the Exclusions. Each criteria can be a window title, or a window class if it is preceded with “ahk_class” (only titles and classes are supported).
Commas should only be placed BETWEEN criteria of a comma-separated list (never at the end).
It is also possible to specify 0 inclusions or 0 exclusions. Specifying 0 inclusions will include ALL windows except those that match the specified exclusions. Specifying 0 exclusions will simply not exclude any of the windows that match the specified inclusions.
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_UseThumbnails | If 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 requires maul.esel’s library from http://www.autohotkey.com |
| cycleWindow_thumbnailColor | Thumbnails 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_thumbnailBorder | Thumbnails are displayed on a GUI. This determines how many pixels the GUI should extend out from behind the thumbnail, creating a border. If you are using Aero, the highlighting effect should be enough, so set this to 0. |
| cycleWindow_disableThumbFade | Disables 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_ListViewGUI | The GUI number (1-99) that will be used to create the ListView which shows the window titles. |
| cycleWindow_ThumbnailGUI | The GUI number (1-99) that will be used to create the windows’ thumbnails (if cycleWindow_UseThumbnails is set to true). |
| cycleWindow_matchMode | TitleMatchMode. Used with AHK’s SetTitleMatchMode (http://www.autohotkey.com |
| cycleWindow_ListViewWidth | The width (in pixels) of the ListView. Increasing the width will cause the ListView to extend farther into the center of the screen. This is set initially to 200. |
| cycleWindow_NewWindowKey | If 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_reverseKey | If this key is held down when you press the cycle key, the function cycles backwards instead of fowards (like shift in Alt-Tab). |
cycleCurrentWindow( regExp = "([^-]*).*" )
Cycles through windows of the same class as the currently active window. This function simply gets the class of the active window, and passes it as a parameter to cycleWindow.
CapsLock & e::cycleWindow("ahk_class CabinetWClass", "", "C:\Users\Jon\School\Fall11") ;Windows Explorer
CapsLock & p::cycleWindow("ahk_class MSPaintApp", "(.*) - Paint", "mspaint")
CapsLock & v::cycleWindow("VLC ahk_class QWidget", "(.*) - VLC media player", "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe")
CapsLock & i::cycleWindow("- Google Chrome", "(.*) - Google Chrome", "C:\Users\Jon\AppData\Local\Google\Chrome\Application\chrome.exe")
CapsLock & n::cycleWindow("ahk_class Notepad2U", "(.*) - Notepad2", "C:\Program Files (x86)\Notepad2\Notepad2.exe")
CapsLock & c::cycleCurrentWindow("([^\-]+).*")The above changes constituted the 1.1 update
The above changes constituted the 1.2 update
Cycles through a subset of windows or launches a path.
cycleWindow( title = "", regExp = "([^-]*).*", pathToRun = "" )
Cycles through windows of the same class as the currently active window.
cycleCurrentWindow( regExp = "([^-]*).*" )