Jump to content

Using Random Function in the Sleep Function not working


aviaf
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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

Sleep(Random(3000, 24000, 1))

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.

Link to comment
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?

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...