Gol*_*Jer 11 autohotkey keyboard-shortcuts ctrl
我一直在激活Firefox然后按Ctrl+ L来聚焦位置栏并进行搜索或输入URL.
理想情况下,我可以在任何应用程序中点击Ctrl+ L和Firefox将激活,位置栏集中并准备输入.在步骤AutoHotkey脚本.
我试过这个,似乎没有用.从我所读到的,代字号是"传递":
^l::
IfWinExist ahk_class MozillaUIWindowClass
{
    WinActivate
    Send ~^l
}
Gol*_*Jer 19
结束了我在AHK论坛上得到这个答案.
它需要使用美元符号修饰符($).
$^l::
IfWinExist ahk_class MozillaUIWindowClass
{
    WinActivate
    Send ^l
}  
从AutoHotkey帮助:
($)这通常只有在脚本使用Send命令发送组成热键本身的键时才需要,否则可能会导致它自己触发.
这是我最终使用的完整脚本.如果Firefox已经处于活动状态,则只需传递Ctrl + L并像往常一样运行.如果在Firefox外部按下Ctrl + L,则激活Firefox并创建一个新选项卡; 准备好搜索.
$^l::
IfWinExist ahk_class MozillaUIWindowClass
{
  IfWinActive ahk_class MozillaUIWindowClass
  {
    Send ^l
  }
  else
  {
    WinActivate
    Send ^t
  }
}