Jump to content

Randomize Pausing


 Share

Recommended Posts

Or simply

Func RandomSleep($PauseMin,$PauseMax)
Local $Pause
If $PauseMin <= $PauseMax Then
   $Pause = Int(Random($PauseMin,$PauseMax + 1)) * 1000
   Sleep($pause)
EndIf
EndFunc;<== RandomSleep End

Append this at the end of your source and call the random pause as function.

Link to comment
Share on other sites

i dont mean that it is paused for a random amount of time, i mean that it is paused until a certain key is pressed...for example the random key it generates is "W", so this would pause until "W" is pressed.

-Brett
Link to comment
Share on other sites

I'm new to AutoIt, so you'll have to make due with partial code:

You fill an array with strings of the keys you want to be randomly chosen.

Where n is number of keys you wish to choose from:

Dim $array[n]

$array[0] = "B"

$array[1] = "{DOWN}"

...

...

$array[n] = "{ESC}"

Then generate a random number between 0 and n:

Dim $rn = Int(Random() * n)

then set a hot key

HotKeySet($array[$rn], "hotkeyfunc")

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...