AutoHotKey:检测 Firefox 组合键中的单键释放
AutoHotKey: detect single key release in keycombo for Firefox
尝试在 AutoHotKey 的帮助下将组合键 Alt+Tab 配置为在 Firefox 中表现为 tab switcher:
#IfWinActive Showcase
LAlt & Tab::Send {tab}
GetKeyState, state, LAlt
if state = U
Send {enter}
基本上这可以防止 Alt+Tab 调出 Windows 和循环的普通 window 切换器通过打开的选项卡,因为 Tab 被推送。然而,当我试图模拟 Windows' window 切换器的行为时,我也希望它能够显示 – Send {enter}
– Left 时最后选择的选项卡Alt 已 发布。 这我似乎无法完成,因为 GetKeyState
只是不会响应,即使 state
变成 U
。在这种情况下如何检测按键释放?
添加:
所以我最终得到了以下代码,它的主要部分做了我想要的:
#IfWinActive ahk_exe firefox.exe <i>; Alt+Tab to Windows</i>
LAlt & tab::
Send {F10} <i>; F10 brings up Showcase in my FF installation</i>
WinWaitActive Showcase
GetKeyState, state, LAlt, P
if state = U
WinClose Showcase
IfWinNotActive Showcase
Send {LWin}
#IfWinActive Showcase <i>; Alt+Tab over Firefox’s tabs</i>
LAlt & tab::
Send {tab}
SetTimer, choice, -50
return
choice: <i>; Thanks, <a href="">@user3419297</a>!</i>
KeyWait, LAlt, P
IfWinActive Showcase
Send {LAlt up} {space}
return
#IfWinActive ahk_exe firefox.exe <i>; Win+Tab over Firefox’s tabs</i>
LWin::F10
#IfWinActive Showcase <i>; Win+Tab to Windows</i>
tab::return
LWin & tab::
WinClose Showcase
WinWaitClose Showcase
WinMinimize ahk_exe firefox.exe
Send {LWin down} {tab} {LWin up}
return
ExitApp
这实际上模拟了 Firefox 中的 Alt+ 和 Win+Tab 行为,我通常在全屏模式下使用:
- 在按住 Alt 的同时按 Tab 将以相同的方式在打开的选项卡中循环 Alt +Tab 周期 windows
- 要退出FF到Windows,Alt+Tab是快速按下和释放;这将调出开始菜单,从那里可以正常使用 Alt+Tab
- Win+Tab 在 Windows 中的工作方式有点不同,不需要按住向下 Win 让它保持运行状态,并且(至少在 Windows 10)不能用 Tab[= 循环通过 windows 70=];这也是通过按 Win+Tab 以相同的方式模拟的(实际上只需 Win 就足够了,但为了保持一致性,我同时按下了两者); Tab 也被阻塞,所以它不能循环,模拟真实 Win+Tab 的工作方式在 Windows
- 要退出 Firefox 的 Win+Tab 到 Windows,将再次按下所述组合 – 这将调出 Win+Tab of Windows 10;也可以通过这种方式轻松访问任务栏
因为我以前不知道任何 AutoHotKey,回想起来这可能是一个有点矫枉过正的任务。然而,这确实迫使我 实际学习 如何在 AHK 中编程,同时磨练我的整体编程技能。为此,这很棒。我经常发现自己本能地在 Firefox 中按下 Alt+Tab 以循环浏览选项卡,就像使用 windows 一样,只会被提醒这实际上只适用于 Windows 中的 windows。直到最近,那就是:)
#IfWinActive Showcase
LAlt & Tab::
Send {Tab}
SetTimer Send_Enter, -50
return
#IfWinActive ; turn off context sensitivity
Send_Enter:
KeyWait, LAlt, L
Send {Alt Up}{Enter}
return
尝试在 AutoHotKey 的帮助下将组合键 Alt+Tab 配置为在 Firefox 中表现为 tab switcher:
#IfWinActive Showcase
LAlt & Tab::Send {tab}
GetKeyState, state, LAlt
if state = U
Send {enter}
基本上这可以防止 Alt+Tab 调出 Windows 和循环的普通 window 切换器通过打开的选项卡,因为 Tab 被推送。然而,当我试图模拟 Windows' window 切换器的行为时,我也希望它能够显示 – Send {enter}
– Left 时最后选择的选项卡Alt 已 发布。 这我似乎无法完成,因为 GetKeyState
只是不会响应,即使 state
变成 U
。在这种情况下如何检测按键释放?
添加:
所以我最终得到了以下代码,它的主要部分做了我想要的:
#IfWinActive ahk_exe firefox.exe <i>; Alt+Tab to Windows</i>
LAlt & tab::
Send {F10} <i>; F10 brings up Showcase in my FF installation</i>
WinWaitActive Showcase
GetKeyState, state, LAlt, P
if state = U
WinClose Showcase
IfWinNotActive Showcase
Send {LWin}
#IfWinActive Showcase <i>; Alt+Tab over Firefox’s tabs</i>
LAlt & tab::
Send {tab}
SetTimer, choice, -50
return
choice: <i>; Thanks, <a href="">@user3419297</a>!</i>
KeyWait, LAlt, P
IfWinActive Showcase
Send {LAlt up} {space}
return
#IfWinActive ahk_exe firefox.exe <i>; Win+Tab over Firefox’s tabs</i>
LWin::F10
#IfWinActive Showcase <i>; Win+Tab to Windows</i>
tab::return
LWin & tab::
WinClose Showcase
WinWaitClose Showcase
WinMinimize ahk_exe firefox.exe
Send {LWin down} {tab} {LWin up}
return
ExitApp
这实际上模拟了 Firefox 中的 Alt+ 和 Win+Tab 行为,我通常在全屏模式下使用:
- 在按住 Alt 的同时按 Tab 将以相同的方式在打开的选项卡中循环 Alt +Tab 周期 windows
- 要退出FF到Windows,Alt+Tab是快速按下和释放;这将调出开始菜单,从那里可以正常使用 Alt+Tab
- Win+Tab 在 Windows 中的工作方式有点不同,不需要按住向下 Win 让它保持运行状态,并且(至少在 Windows 10)不能用 Tab[= 循环通过 windows 70=];这也是通过按 Win+Tab 以相同的方式模拟的(实际上只需 Win 就足够了,但为了保持一致性,我同时按下了两者); Tab 也被阻塞,所以它不能循环,模拟真实 Win+Tab 的工作方式在 Windows
- 要退出 Firefox 的 Win+Tab 到 Windows,将再次按下所述组合 – 这将调出 Win+Tab of Windows 10;也可以通过这种方式轻松访问任务栏
因为我以前不知道任何 AutoHotKey,回想起来这可能是一个有点矫枉过正的任务。然而,这确实迫使我 实际学习 如何在 AHK 中编程,同时磨练我的整体编程技能。为此,这很棒。我经常发现自己本能地在 Firefox 中按下 Alt+Tab 以循环浏览选项卡,就像使用 windows 一样,只会被提醒这实际上只适用于 Windows 中的 windows。直到最近,那就是:)
#IfWinActive Showcase
LAlt & Tab::
Send {Tab}
SetTimer Send_Enter, -50
return
#IfWinActive ; turn off context sensitivity
Send_Enter:
KeyWait, LAlt, L
Send {Alt Up}{Enter}
return