Note: I've mapped RControl onto my LWin key via Windows registry, so autohotkey sits on top of that.
I found many solutions that said simply
>^Tab::
Send {LAlt down}{Tab}
KeyWait RControl
Send {LAlt up}
return
The issue here is that it doesn't handle alt+tab+tab+tab to go 3 programs back.
I also realized that AutoHotKeys will block keyboard signals until you've completed the shortcut by releasing all keys, so any additional tabs that are sent while I held down the control key are ignored.
What I realized is I needed a 2nd AutoHotKeys process to force that through. It seems like a rather redundant thing to write but here's my 2nd script:
#IfWinActive "ahk_class TaskSwitcherWnd"
Tab::Send {Tab}
#IfWinActive
If you're not familiar, the #IfWinActive
stuff is just to make it so that this isn't firing every time the Tab key is sent - it's only while Windows' task switcher is in focus. Ultimately, this script simply says Tab::Send {Tab}
.
Then you need to tell it to also react to the shift key. Oddly, the task switcher listens for that just fine but not Tab, so we don't need to forward the Shift key in that script too.
Ultimately, my two scripts look like this:
Script 1
#IfWinNotActive ahk_class TaskSwitcherWnd
; Remap Ctrl-Tab to Alt-Tab
$>^Tab::
Send {Alt down}{Tab}
Keywait Control
Send {Alt up}
return
; Remap Ctrl-Shift-Tab to Alt-Shift-Tab
$>^+Tab::
Send {Alt down}{Shift down}{Tab}
Keywait Control
Send {Alt up}{Shift up}
return
#IfWinActive
Script 2
#IfWinActive ahk_class TaskSwitcherWnd
Tab::Send {Tab}
#IfWinActive
Run these simultaneously.