bryantan179 wrote:What if i hold capslock and i hold ''D''button , i want it to send D instead of Send, {A Down}{A Up} ? is it possible ?
Also , if i hold the button for few seconds and release it ,sometimes it will take few second for the script to stop looping . is it possible to stop the script from looping immediately after capslock is released , maybe a method to ignore the rest of the script that hasnt been looped when clicked .
#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%
#MaxThreadsPerHotkey 2
$*Capslock::
Send, {2 Down}
SetTimer, Spam1, 10
SetTimer, Spam2, 10
KeyWait, Capslock
SetTimer, Spam1, Off
SetTimer, Spam2, Off
Send, {2 Up}
return
Spam1:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return
Spam2:
Send, {A Down}{A Up}
return
Hmm it shouldn't be taking seconds to stop. I guess we will have to use pause or exit? Anyways tell me if this works like you wanted it to.
If the problem persists then we will use while getkeystate for capslock
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2
$*Capslock::
Send, {2 Down}
SetTimer, Spam1, 10
SetTimer, Spam2, 10
KeyWait, Capslock
SetTimer, Spam1, Off
SetTimer, Spam2, Off
Send, {2 Up}
return
Spam1:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return
Spam2:
Send, {A Down}{A Up}
return
Capslock & d::
Send, {2 Down}
SetTimer, Spam3, 10
SetTimer, Spam4, 10
KeyWait, d
SetTimer, Spam3, Off
SetTimer, Spam4, Off
Send, {2 Up}
return
Spam3:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return
Spam4:
Send, {D Down}{A Up}
return
esc:: ExitApp ; esc, exits the script