我从https://autohotkey.com/boards/viewtopic.php?f=5&t=51596找到了这个脚本,它工作得很好。我喜欢它很容易理解并轻松更改您想要的键。
事情是:
当它第一次运行而无需我按任何键时,它会触发“a”
我想使用此方法设置其他键,但它仅适用于第一个键分配。我复制了工作脚本并尝试修改变量名称以免相互干扰并将其粘贴到最底部的“返回”下方,但我在下面添加的任何内容都
KeyWait, {%Key%} tapCount = Return
不起作用
这是当前修改的部分工作脚本,我在这里缺少什么
Key = a ;Main Keybind
tLength = -300 ;Time before key is pressed
tapSingle = a ;Single Tap Keybind
tapDouble = b ;Double Tap Keybind
tapHold = c ;Hold Keybind
;----------------------------------------------------------
Hotkey, $%Key%, startTimer
startTimer:
If !endTimer
SetTimer, endTimer, %tLength%
tapCount++
Return
endTimer:
If GetKeyState(Key, "P") and tapCount < 2
Send, {%tapHold%}
Else If tapCount = 2
Send, {%tapDouble%}
Else If tapCount = 1
Send, {%tapSingle%}
KeyWait, {%Key%}
tapCount =
Return
==ANYTHING BELOW IS NOT WORKING==
bKey = b ;Main Keybind
btLength = -300 ;Time before key is pressed
btapSingle = w ;Single Tap Keybind
btapDouble = a ;Double Tap Keybind
btapHold = s ;Hold Keybind
;----------------------------------------------------------
Hotkey, $%bKey%, bstartTimer
bstartTimer:
If !bendTimer
SetTimer, bendTimer, %btLength%
btapCount++
Return
bendTimer:
If GetKeyState(bKey, "P") and btapCount < 2
Send, {%btapHold%}
Else If btapCount = 2
Send, {%btapDouble%}
Else If btapCount = 1
Send, {%btapSingle%}
KeyWait, {%bKey%}
btapCount =
Return