Hi all...so I have this very basic script which turn son with f 11 off with f 12 and sends the "8" key to the active window every (however many seconds I want). I'm trying to understand how randomizers work?
For example....how would I modify this if I wanted it to send "random" keystrokes from a list (like 1-8 for example) at a random interval of seconds?
F11::
BreakLoop := 0
Loop
{
if BreakLoop = 1
break
send {8}
sleep 180000
}
return
F12::
BreakLoop := 1
return
Randoms
Re: Randoms
Hello, remember to use code tags to show your code.
You can use:
keys := [1,2,3,4,5,6,7,8]
and inside the loop you can do a random that goes from 1 to keys' max index:
That will "pick" a random element from the array keys and send it.
You can use:
keys := [1,2,3,4,5,6,7,8]
and inside the loop you can do a random that goes from 1 to keys' max index:
Code: Select all
random, rand, 1, % keys.maxIndex()
send % keys[rand]
Re: Randoms
Thanks, and is there a way to randomize the timer aspect? The delay
Re: Randoms
Same way:
Code: Select all
random, rand, minValue, maxValue
sleep % rand
Re: Randoms
Code: Select all
F11::
keys := [1,2,3,4,5,6,7,8]
BreakLoop := 0
Loop
{
if BreakLoop = 1
break
random, rand, 1, % keys.maxIndex()
send % keys[rand]
random, rand, 1000, 20000
sleep % rand
}
return
F12::
BreakLoop := 1
return
Re: Randoms
it might be working need to test here
Who is online
Users browsing this forum: ccqcl, Descolada, inseption86, mebelantikjaya and 344 guests