如何将截获的密钥传递给 autohotkey 中的应用程序
我经常激活 Firefox,然后按 Ctrl+L 聚焦地址栏并进行搜索或输入 URL。
理想情况下,我可以在任何应用程序中按下 Ctrl+L,Firefox 将被激活,并且位置栏已聚焦并准备好输入。步骤 AutoHotkey 脚本编写。
我已经尝试过这个,但似乎不起作用。根据我的阅读,波形符是“传递”:
^l::
IfWinExist ahk_class MozillaUIWindowClass
{
WinActivate
Send ~^l
}
I'm constantly activating Firefox then hitting Ctrl+L to focus the location bar and do a search or type a URL.
Ideally I can be in any application and hit Ctrl+L and Firefox will be activated with the location bar focused and ready for input. In steps AutoHotkey scripting.
I've tried this and it doesn't seem to work. From what I've read, tilde is "pass-through":
^l::
IfWinExist ahk_class MozillaUIWindowClass
{
WinActivate
Send ~^l
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最终我自己在AHK 论坛上得到了这个问题的答案。< br>
它需要使用美元符号修饰符 ($)。
来自 AutoHotkey 帮助:
这是我最终使用的完整脚本。如果 Firefox 已处于活动状态,则只需传递 Ctrl+L 即可正常运行。如果在 Firefox 外部,按下 Ctrl+L 则会激活 Firefox 并创建一个新选项卡;准备好进行搜索。
Ended up getting the answer to this one myself on the AHK forum.
It requires the use of the dollar sign modifier ($).
From AutoHotkey help:
And here's the full script I ended up using. If Firefox is already active Ctrl+L is simply passed through and behaves as usual. If outside of Firefox when Ctrl+L is pressed then Firefox is activated and a new tab is created; ready for searching.
我不认为波浪号适用于这种情况,但 Send 发送按键的速度可能比窗口实际激活的速度更快,所以像这样的东西可能会更好:
I don't think the tilde applies in this instance, but Send might send the keys faster than the window actually activates, so something like this might be better: