please help me out of this - what did I do wrong that my script is not working.
Goal is, the loop sends randomly 1,2,3,4,5. It shall start by manually pressing "Q" and shall stop again when pressing "W"
Code: Select all
#NoEnv
#Warn
#SingleInstance Force
SendMode Input
SetWorkingDir %A_ScriptDir%
-----------------------------------------------------------------------------------------
Q::
active:=1
if(active=0){
break
}
RandomFire()
RandomFire() {
static AllKeys := ["1", "2", "3", "4", "5"]
keys := AllKeys.Clone()
loop % AllKeys.Length()
{
Random n, 1, % keys.Length()
key := keys.RemoveAt(n)
send {%key% down}
Random sleep1, 281, 993
Sleep %sleep1%
send {%key% up}
}
}
W::
active:=0
return