I found this script from https://autohotkey.com/boards/viewtopic.php?f=5&t=51596 it works perfectly. I like that it is easy to understand and change your desired key easily.
The thing is:
It fires "a" when it runs for the first time without me pressing any key
I wanted to set other keys using this method but It only works for the first key assignment. I copied the working script and tried to modify the variable names not to interfere with each other and pasted it below the very bottom "return" but anything that I add below the
KeyWait, {%Key%} tapCount = Return
doesn't work
Here's the currently modified partially working script, what am I missing here
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