Sign in to follow this  
Followers 0
aviaf

Using Random Function in the Sleep Function not working

5 posts in this topic

#1 ·  Posted (edited)

new at autoit and im trying to get the script to pause inbetween steps for a random amount of time: actually between 3000-24000 ms

I successfully made it sleep and pause the script by using:

Sleep(3000)

which makes it pause 3 sec

but i want it to stop a random amount between 3-24 sec

so i thought to use:

Sleep(Random ( [3000 [, 24000 [, 0]]] ))

But when i run it it comes up with an error that says:

"Sleep(Random ( [3000 [, 24000 [, 0]]] ))

Sleep(Random ( ^ ERROR

Error: Error in expression."

What am I doing wrong?

Also, another problem, I want to add a little comment in the script so i can keep track of diff components of the script cuz its so long, what do i add to it so its not executed but just there like a description. thx

Edited by aviaf

Share this post


Link to post
Share on other sites



The brackets are used to show you that those parameters are optional.

Sleep(Random(3000, 24000, 1))


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

The brackets are used to show you that those parameters are optional.

Sleep(Random(3000, 24000, 1))

oh ok, thanks, it works now, (I took it straight from the help file and jsut changed min max, and flag :P)

Anything for the second problem?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

oh ok, thanks, it works now, (I took it straight from the help file and jsut changed min max, and flag :P)

Anything for the second problem?

Comments are used with a semi colon in autoit, or with #cs/#ce witch are all noted in the help file.

Tutorials:

http://www.autoitscript.com/forum/index.ph...c=19434&hl=

http://www.autoitscript.com/forum/index.php?showtopic=21048

Edited by SmOke_N
Typo

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0