Hi all,
Here is a script I bashed up that allows me to use ALT+F1 to F12 to select open windows.
I wanted this so that with fullscreen PuTTY sessions I could emulate being back on the Linux console, where swapping between terminals used the afformentioned quick keystrokes!
It is also quite handy for quickly switching between windows, as I loathe using ALT-TAB.
There are 2 disadvantages however:
- ALT+F4 is remapped by the above (You could change these keys to Ctrl+F1 etc if you wanted, but I dont care...)
- The window order is determined by the window ID, which are a bit random, and thus not in the same order as they are on the taskbar, so it takes a bit of guessing to find out which button brings up which window.
(-- Does anyone know how the open windows on the taskbar are sorted by? That would be much nicer...)
Thanks for Autohotkey, its the bomb!
-Joe
P.S. If anyone knows a better way or sorting arrays than throwing them in and out of strings, let me know. Ditto for the array access during function call business.
--- Code ----
Code:
SwitchWindow(n) {
; Get open Window ID list
; then activate specific window.
WinGet, idlist, List
if idlist < %n%
{
Return ; Abort if not enough windows open
}
Loop %idlist%
{
temp := idlist%A_Index%
idstrlist = %temp%,%idstrlist%
}
Sort, idstrlist, N D,
StringSplit, idlist, idstrlist, `,
temp := idlist%n%
WinActivate, ahk_id %temp%
return
}
!F1::
SwitchWindow(1)
return
!F2::
SwitchWindow(2)
return
!F3::
SwitchWindow(3)
return
!F4::
SwitchWindow(4)
return
!F5::
SwitchWindow(5)
return
!F6::
SwitchWindow(6)
return
!F7::
SwitchWindow(7)
return
!F8::
SwitchWindow(8)
return
!F9::
SwitchWindow(9)
return
!F10::
SwitchWindow(10)
return
!F11::
SwitchWindow(11)
return
!F12::
SwitchWindow(12)
return