What I wish to accomplish is when the loop that is sending "a" is ongoing, anytime I press "b" key, it will pause "a" and insert "bbbbb" in that ongoing string without having to toggle(stop) the "a" key in the first place.
For example the output should be: aaaaaaabbbbbbaaaaaaaaaaa (5 "b"s are inserted whenever the"b" key is pressed, and "a" continues automatically afterwards)
I have tried to add "critical" but it didn't work.
Code: Select all
a::
if (HitToggle1 := !HitToggle1){
SetTimer, Hita, 300
GoSub, Hita
} else {
SetTimer, Hita, Off
}
return
Hita:
ControlSend, ahk_parent, a, Notepad
sleep 200
return
b::
ControlSend, ahk_parent, b, Notepad
sleep 200
ControlSend, ahk_parent, b, Notepad
sleep 200
ControlSend, ahk_parent, b, Notepad
sleep 200
ControlSend, ahk_parent, b, Notepad
sleep 200
ControlSend, ahk_parent, b, Notepad
sleep 200
return