您好,我试图制作一个AHK脚本,该脚本发送两次按键,一次是在我按住该按钮时,另一次是在释放键盘上的按钮时。到目前为止,我只是想出了将任何按钮都进行切换的相反方法,但是,这对我并没有真正的帮助D:感谢任何帮助!
答案 0 :(得分:0)
$前缀可防止热键自身触发,因为它强制使用键盘挂钩。
$a::
SendInput, a
KeyWait, a ; wait for the key to be released
SendInput, a
return
对于多个按键,您可以使用:
#NoEnv
#SingleInstance Force
SendMode Input
#InstallkeybdHook
#UseHook ; prevents the keys from triggering itself
keys := ["a","b","c","d","1","2","3","4"] ; ....
for each, key in keys
hotkey, %key%, send_key_twice, on
return
send_key_twice:
Send, %A_ThisHotkey%
KeyWait, %A_ThisHotkey% ; wait for the key to be released
Send, %A_ThisHotkey%
return