0

Since switching from Windows 7 to Windows 10, the following does not work any more:

#IfWinActive ahk_class TaskSwitcherWnd
;; (Hotkeys that should only be active when the task switcher window is active)
#If

Apparently the task switcher is not a window any more, it is also not detected with DetectHiddenWindows, On.

Is there a way to detect the task switcher in windows 10?

816-8055
  • 509
  • 7
  • 15

3 Answers3

2

On Windows 10 its title is Task Switching, class MultitaskingViewFrame, and process explorer.exe.
And I didn't need hidden windows detecting to be set for detecting it either.

0x464e
  • 5,948
  • 1
  • 12
  • 17
0

Currently I have the following workaround:

#IfWinActive ahk_class TaskSwitcherWnd
;; (Hotkeys that should only be active when the task switcher window is active)
; Workaround for Windows 10
#If RegExMatch( A_OSVersion, "^10\." )
~^!Tab::varTaskSwitcherActive := true
#If varTaskSwitcherActive
~Esc::
~Enter::
~NumpadEnter::
~Space::
~LButton::
~MButton::
~RButton::
    varTaskSwitcherActive := false
return
;; (Hotkeys that should only be active when the task switcher window is active)
#If

→ Explanation:

  • If the OS version variable matches Windows 10, then I set a variable on AltGr+Tab
  • If the variable is set, the hotkeys can be done
  • Also if the variable is set and any key that causes the task switcher to disappear is pressed, then the variable is reset

The problem with this is that the task switcher might disappear because of other events. Also I'm not sure if these are all the keys that cause the task switcher to disappear.

816-8055
  • 509
  • 7
  • 15
0

Short Answer

The only ID I could get working was a combination of the class and unique ID.

#IfWinActive ahk_class Windows.UI.Core.CoreWindow ahk_exe Explorer.EXE

I found them by activating AHK's Window Spy and squinting at it while the Task View was open.

This doesn't conflict with the start menu search, file explorer, or other system contexts I've tested.

A Useful Way to Navigate Task View

The following is not directly relevant, but there aren't many posts on Task View and AHK, so this may be helpful to have here.

I'm using this ID for context-sensitive hotkeys to navigate in Task Switcher without moving my hand (h,j,k,l instead of arrow keys) and open or close windows. If you're curious, this is the script:

F4::

run, "C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Window Switcher.lnk"
; this was originally written for Win 8.1, but it still works in Win 10 despite the
; shortcut being invisible in File Explorer
return

#IfWinActive ahk_class Windows.UI.Core.CoreWindow ahk_exe Explorer.EXE
l::Send, {Right}
h::Send, {Left}
j::Send, {Down}
k::Send, {Up}
o::Enter
x::Delete

return

I use it in combination with this little gem for switching to the most recent window without any GUI splash (simpler AHK solutions I tried had glitches, and I left out the menu part of this script). Task View is great, but often you just need to get to your last window without any fuss.