I keep getting this error "A return must be encountered prior to this "}".
I tried putting a return in at the end of the block, but still encounter the error.
Is it a subroutine mess up? or a label not being called?
Code: Select all
#SingleInstance, force
#NoEnv
#Persistent
ChrArray := ["1","1","1","2","2","2","4","3","3","5","6","6","6","7","8","9"]
Loop {
Loop {
startTime := A_TickCount, A_lf := "`n"
Random, interval, 10000, 20000 ; between 10 and 20 seconds just for testing
SetTimer, MySub, 1000
return
MySub:
ToolTip, % interval A_lf A_TickCount-starttime, 1000, 100
If ( A_TickCount > starttime+interval)
return
Send, % RandomChrArray(ChrArray)
Sleep, % RandomNum(100, 150)
Send, % RandomChrArray(ChrArray)
Sleep, % RandomNum(100, 150)
Send, {tab down}{tab up}
IfGreater, A_TickCount, % startTime+interval, Break
}
Send, ^0
Sleep, 1000
Send, {tab down}{tab up}
Send, ^0
Sleep, 1000
Send, {tab down}{tab up}
Send, {E down}{E up}
Sleep, 1000
Send, {tab down}{tab up}
Send, {E down}{E up}
Sleep, 1000
Send, {tab down}{tab up}
Send, {E down}{E up}
}
RandomChrArray(ArrayVar) {
Random, RandChr, 1, % ArrayVar.MaxIndex()
return ArrayVar[RandChr]
}
/*
RandomChr(Min := 65, Max := 90) { ; A=65, Z=90
Random, RandChr, % Min, % Max
return Chr(RandChr)
}
*/
RandomNum(Min, Max) {
Random, RandNum, % Min, % Max
return RandNum
}
~space::pause