Guest rcm87 Posted July 26, 2004 Posted July 26, 2004 I would like autoit to send a character, sleep for a random amount of time between 2 set times. So pick a random time beteen 10 seconds and 15 seconds and send a character. I am a brand new script writer so this could be pretty simple. It looks like to me they sleep is looking for an int and not a value. Here is what I have so far. Thanks for the help. $timeleft = 28 While $timeleft > 0 $sleeping = Random(50000 , 10000) Send ("2") sleep = $sleeping; ;<--errors out here $timeleft = $timeleft - 1
autoitNOW Posted July 27, 2004 Posted July 27, 2004 (edited) $a = 10 $b = 15 $c = Int(Random($a, $b + 1)) Sleep($c) This seems to work too, but this is just for the sleeping part. Edited July 27, 2004 by autoitNOW An ADVOCATE for AutoIT
Zerg Posted July 27, 2004 Posted July 27, 2004 sleep = $sleeping; ;<--errors out hereIt should be $sleep = $sleepingIt seem like you are just miss the $ symbol in font of sleep
emmanuel Posted July 27, 2004 Posted July 27, 2004 sleep = $sleeping; ;<--errors out here It should be $sleep = $sleeping It seem like you are just miss the $ symbol in font of sleep nope, it was that he wanted sleep to be the command, and $sleeping to be the variable used by it. this would do that: $timeleft = 28 While $timeleft > 0 $sleeping = Random(50000 , 10000) Send ("2") sleep($sleeping) $timeleft = $timeleft - 1 wend;- this was missing of course, Larry's does the same thing while saving the use of a variable that's not needed, unless $sleeping will be reused at some point later? "I'm not even supposed to be here today!" -Dante (Hicks)
autoitNOW Posted July 28, 2004 Posted July 28, 2004 (edited) sleep = $sleeping; ;<--errors out hereIt should be $sleep = $sleepingIt seem like you are just miss the $ symbol in font of sleep emmanuel is correct. I was using sleep as the command in that example and in my tests it works. $c is the variable in which the random number will be placed. I did make a mistake by using 10 and 15 in that example, and it should be 10000 and 15000 because 5000 is just 5 seconds. Edited July 28, 2004 by autoitNOW An ADVOCATE for AutoIT
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now