使用 AutoHotKey 发送 A_ThisHotkey
Send A_ThisHotkey with AutoHotKey
我有以下使用 A_ThisHotkey
的 AutoHotKey 脚本:
spamLimit(limitTime)
{
send %A_ThisHotkey%
}
p::spamLimit(500)
怎么按P不发送字母p
而是打开下面的window
?
它只是循环 p
-> 启动与 p
热键关联的命令 -> send p
-> 启动与 p
热键关联的命令 - > send p
-> …
要防止这种行为,您可以使用命令Hotkey
暂时禁用热键。示例:
spamLimit(limitTime)
{
Hotkey, %A_ThisHotkey%, off
send %A_ThisHotkey%
}
p::spamLimit(500)
另一个解决方案是在定义命令时使用$
,which forces the hook in the hotkey, i.e. disallows the hotkey to be triggered by its own send commands and generally most other virtual (non-physical) key presses. Example (one needs to use the function StringReplace
,否则输出$p
而不是p
。):
spamLimit(limitTime)
{
StringReplace, key, A_ThisHotkey, $, , All
send %key%
sleep limitTime
}
$p::spamLimit(500)
我有以下使用 A_ThisHotkey
的 AutoHotKey 脚本:
spamLimit(limitTime)
{
send %A_ThisHotkey%
}
p::spamLimit(500)
怎么按P不发送字母p
而是打开下面的window
?
它只是循环 p
-> 启动与 p
热键关联的命令 -> send p
-> 启动与 p
热键关联的命令 - > send p
-> …
要防止这种行为,您可以使用命令Hotkey
暂时禁用热键。示例:
spamLimit(limitTime)
{
Hotkey, %A_ThisHotkey%, off
send %A_ThisHotkey%
}
p::spamLimit(500)
另一个解决方案是在定义命令时使用$
,which forces the hook in the hotkey, i.e. disallows the hotkey to be triggered by its own send commands and generally most other virtual (non-physical) key presses. Example (one needs to use the function StringReplace
,否则输出$p
而不是p
。):
spamLimit(limitTime)
{
StringReplace, key, A_ThisHotkey, $, , All
send %key%
sleep limitTime
}
$p::spamLimit(500)