我如何通过传递截获的关键应用中的AutoHotkey

问题描述:

我不断激活火狐然后打按Ctrl +大号集中的位置吧,做一个搜索或输入一个网址。我如何通过传递截获的关键应用中的AutoHotkey

理想我可以在任何应用程序和打按Ctrl +大号 Firefox将与地址栏被激活集中并准备输入。在步骤AutoHotkey脚本。

我试过这个,它似乎没有工作。从我读过,波浪是“直通”:

^l:: 
IfWinExist ahk_class MozillaUIWindowClass 
{ 
    WinActivate 
    Send ~^l 
} 
+0

刚才发现这个大约30秒之前,我要发布相同的基本问题。谢谢! – asfallows 2012-01-10 20:48:08

结束了自己在AHK forum得到答案。
它需要使用美元符号修饰符($)。

$^l:: 
IfWinExist ahk_class MozillaUIWindowClass 
{ 
    WinActivate 
    Send ^l 
} 


从AutoHotkey的帮助:

($)这通常是只有必要的,如果脚本使用send命令发送包括热键本身的钥匙,否则可能会造成其触发自己。


这是我最终使用的完整脚本。如果Firefox已经处于活动状态,Ctrl + L只是简单的通过并且照常运行。如果按下Ctrl + L之后在Firefox外部,则Firefox将被激活并创建一个新选项卡;准备搜索。

$^l:: 
IfWinExist ahk_class MozillaUIWindowClass 
{ 
    IfWinActive ahk_class MozillaUIWindowClass 
    { 
    Send ^l 
    } 
    else 
    { 
    WinActivate 
    Send ^t 
    } 
} 

我不认为波浪适用于这种情况,但发送比窗口实际上可能激活发送键,可快速,所以像这可能会更好:

SetKeyDelay, 10, 10 ; adds 10ms delay between and during keystrokes 
IfWinExist, ahk_class MozillaUIWindowClass 
{ 
    WinActivate, 
    WinWaitActive, ; waits until window is active 
    Send, ^l 
} 
return