A different but faster approach to window-switching, or an alternative to Alt-Tab.
In a nutshell
Allows one to tab through a narrowed subset of windows, as one normally alt-tabs through the set of all visible windows. This is done by assigning a single function-call to a single hotkey with the format "keyOne & keyTwo" (Hotkeys/Custom Combinations).
[slightly old] Video Demo
Parameters: cycleWindow(title, regExp, pathToRun)[*:2xh3zfkb]title - used to determine which windows are in the subset (e.g. windows that belong to a specific app). (see WinGet/Parameters/WinTitle)
- regExp - used to trim each window's title for how it is displayed in the ListView. The 1st group of the regular expression gets displayed. If regExp is "0", the ListView will not be displayed at all. (see Regular Expressions (RegEx) - Quick Reference)
- pathToRun - the path to launch the app, if necessary.
- All Windows
LAlt & Tab::cycleWindow() ;overrides the default Alt-Tab hotkey in windows (but it can still be activated by using RAlt) ;cycles through all visible windows, just like the standard Alt-Tab
CapsLock & n::cycleWindow("Notepad") ;cycles through all notepad window ;(specifically, windows with "notepad" in their title)
- Windows Explorer
CapsLock & e::cycleWindow("ahk_class CabinetWClass") ;cycles through all open windows of Windows Explorer
CapsLock & p::cycleWindow("- Paint", "(.*) - Paint", "C:\Windows\System32\mspaint.exe") ;cycles through all MSPaint windows (specifically, windows with "- Paint" in their title) ;Titles are displayed in a ListView, each being trimmed according to the RegEx of the 2nd paramter. ;If no MSPaint windows exist, MSPaint is launched by running the path "C:\Windows\System32\mspaint.exe" in the 3rd parameter.
- Internet Browserzzz
CapsLock & i::cycleWindow("|ahk_class MozillaUIWindowClass, ahk_class Chrome_WidgetWin_0, ahk_class OperaWindowClass, ahk_class IEFrame") ;cycles through browser windows belonging to Firefox, Chrome, Opera, or InternetExplorer ;the default regex is "([^-]*).*", so title-trimming for the ListView is already handled pretty well without a 2nd parameter.This example uses the Inclusion/Exclusion feature for the 1st parameter. See the documentation.
LAlt & Tab::cycleWindow("||ahk_class BasicWindow") ;cycles all windows, excluding Windows 7 Desktop GadgetsAlso uses Inclusion/Exclusion.
- fixed thumbnail-sizing bug occuring when corresponding window was about full height of the screen (‘twas a silly mistake)
- removed obsolete cycleWindow_shrinkThumb setting
- removed Critical command from top of function, fixing some really weird issues resembling buffered hotkey threads (even though “#MaxThreadsBuffer” was off)
- fixed the highlight-fading’s “cutting-out” issue, which was mostly accomplished through the change immediately above
- added ability to change ListView width
The above changes constituted the 1.1 update
- user can now cycle backwards on the first iteration (in the case that a window in the subset is already active), whereas before user could only cycle backwards on the second iteration and after.
- all parameters for cycleWindow are optional now
- the function always removes windows with blank titles from the list
- +).*” to display the title.
- +).*” as well, instead of “(.*)”
- Inclusion/Exclusion - much more flexible and complex way to narrow subset
- function only removes blank titles when the title parameter is blank (or excluded) or there are no inclusions specified within the title parameter (in the inclusion/exclusion mode)
- Added code that removes the specific “Start, ahk_class Button” window from the list rather than simply excluding all windows with “Start” in their title. This code is run whenever the removeBlankTitles code is run.
- modified default regexes
- ListView width is now set initially to 200
The above changes constituted the 1.2 update
- Removed accidental “.” from the end of the line LV_Modify(i, “+Select”), which may have prevented use with AHK_L. (update 1.21)
- Tidied up code for removing extraneous windows. The code for removeBlankTitles will ALWAYS get run (as before). However, other extraneous windows, like “Start” and “Progman”, get removed when the title parameter is blank, or there are 0 inclusions.
- Fixed bug in removeStart code for “Start, ahk_class Button” where the last window in the list would be excluded. (update 1.22)