#SingleInstance Force
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
Suspend, On
Inputbox, cps, Target CPS,0 for no delay (may crash games),,,,,,,,10
inputbox, key, Manual trigger hotkey,% "e.g. Esc, F1, F2, 1, 2, a, b",,,,,,,,n
inputbox, holdSpam, Spam while pressing,% "1 turn on, 0 turn off",,,,,,,,0
inputbox, exitkey, Stop script hotkey,% "e.g. Esc, F1, F2, 1, 2, a, b",,,,,,,,Esc
Suspend, Off
manualtrigger=~%key%
Hotkey,%manualtrigger%,spamtoggle
Hotkey,%exitkey%,stopscript
spamOn := False
delay := cps == 0 ? 0 : 1000/cps
return
~LButton::
if (!holdSpam) {
return
}
loop {
GetKeyState, state, LButton, P
if state = U
break
Click
Sleep, delay
}
return
spamtoggle:
spamOn := !spamOn
Settimer, spam, -1
return
spam:
counter:=0
startTime:=A_TickCount
loop {
if (!spamOn) {
break
}
counter+=1
Click
Sleep, delay
}
totaltime:=A_TickCount-starttime
cps := counter * 1000 // totaltime
;if (counter > 0) {
; msgbox, % "Clicks: " counter " CPS: " cps
;}
return
stopscript:
ExitApp
return