AutoHotkey:在 Windows 10 中检测任务切换器 window
AutoHotkey: Detect task switcher window in Windows 10
自从 Windows 7 切换到 Windows 10 后,以下内容不再有效:
#IfWinActive ahk_class TaskSwitcherWnd
;; (Hotkeys that should only be active when the task switcher window is active)
#If
显然任务切换器不再是 window,DetectHiddenWindows, On
也未检测到它。
有没有办法检测 windows 10 中的任务切换器?
目前我有以下解决方法:
#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
→ 解释:
- 如果OS版本变量匹配Windows10,那么我在AltGr+Tab
上设置一个变量
- 如果设置了变量,热键就可以了
- 此外,如果设置了变量并且按下了导致任务切换器消失的任何键,则变量被重置
问题是任务切换器可能会因为其他事件而消失。
另外我不确定是否这些都是导致任务切换器消失的键。
在 Windows 10 上,它的标题是 Task Switching
、class MultitaskingViewFrame
,并且处理 explorer.exe
。
而且我也不需要设置隐藏 windows 检测来检测它。
简答
我唯一可以使用的 ID 是 class 和唯一 ID 的组合。
#IfWinActive ahk_class Windows.UI.Core.CoreWindow ahk_exe Explorer.EXE
我通过激活 AHK 的 Window Spy 并在任务视图打开时眯着眼看着它找到了它们。
这与开始菜单搜索、文件资源管理器或我测试过的其他系统上下文没有冲突。
导航任务视图的有用方法
以下内容没有直接相关性,但任务视图和 AHK 上的帖子不多,所以放在这里可能会有所帮助。
我将此 ID 用于上下文相关的热键,以便在不移动我的手(h、j、k、l 而不是箭头键)的情况下在任务切换器中导航以及打开或关闭 windows。如果你很好奇,这是脚本:
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
我将它与 结合使用以切换到最新的 window 而没有任何 GUI 启动(我尝试过的更简单的 AHK 解决方案有问题,我省略了这个脚本的菜单部分).任务视图很棒,但通常您只需要毫不费力地查看最后一个 window。
自从 Windows 7 切换到 Windows 10 后,以下内容不再有效:
#IfWinActive ahk_class TaskSwitcherWnd
;; (Hotkeys that should only be active when the task switcher window is active)
#If
显然任务切换器不再是 window,DetectHiddenWindows, On
也未检测到它。
有没有办法检测 windows 10 中的任务切换器?
目前我有以下解决方法:
#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
→ 解释:
- 如果OS版本变量匹配Windows10,那么我在AltGr+Tab 上设置一个变量
- 如果设置了变量,热键就可以了
- 此外,如果设置了变量并且按下了导致任务切换器消失的任何键,则变量被重置
问题是任务切换器可能会因为其他事件而消失。 另外我不确定是否这些都是导致任务切换器消失的键。
在 Windows 10 上,它的标题是 Task Switching
、class MultitaskingViewFrame
,并且处理 explorer.exe
。
而且我也不需要设置隐藏 windows 检测来检测它。
简答
我唯一可以使用的 ID 是 class 和唯一 ID 的组合。
#IfWinActive ahk_class Windows.UI.Core.CoreWindow ahk_exe Explorer.EXE
我通过激活 AHK 的 Window Spy 并在任务视图打开时眯着眼看着它找到了它们。
这与开始菜单搜索、文件资源管理器或我测试过的其他系统上下文没有冲突。
导航任务视图的有用方法
以下内容没有直接相关性,但任务视图和 AHK 上的帖子不多,所以放在这里可能会有所帮助。
我将此 ID 用于上下文相关的热键,以便在不移动我的手(h、j、k、l 而不是箭头键)的情况下在任务切换器中导航以及打开或关闭 windows。如果你很好奇,这是脚本:
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
我将它与