Sendkey will iterate the array.
But when the label get complicated, I want to pass parameter into it.
Code: Select all
global start := true
ArrOrMaxNum :=["test1", "test2", "test3"]
global index := 1
q::
global start
global index
if start
{
SetTimer, SendKey, 1000
}
else
{
index := 1
SetTimer, SendKey, Off
}
start := !start
Return
SendKey:
{
global index
Mod_base := ArrOrMaxNum.MaxIndex()
index_tmp := Mod(index, Mod_base)
if(index_tmp = 0)
{
index_tmp := 3
}
key := ArrOrMaxNum[index_tmp]
gosub, %key%
index := index + 1
Return
}
test1:
{
MsgBox %A_ThisLabel%
Return
}
test2:
{
MsgBox %A_ThisLabel%
Return
}
test3:
{
MsgBox %A_ThisLabel%
Return
}