Is there a way to have a macro wait between 30 and 130 seconds before repeating itself?
If so, how would this be set up?
Random Wait Time Question
Moderators: Dorian (MJT support), JRL
Macro Scheduler Help wrote:Random>Range,Result
Returns a random number within the specified range where 0 works, a random number between 0 and a programmer supplied upper range is generated each time Random> is called. Since you are asking for the lower part of the random range to be greater than 0, you have to manipulate your numbers a little. The upper range number will actually be 1 less than the number supplied, so you will specify 131 as your random number maximum. Then you subtract the smaller number from the larger number. In your case 131-30=101. 101 becomes the "range" for the Random> function. After the Random> function generates a number and assigns it to a variable you then add the number that is the lower portion of the range, in your case 30, to the result. The following two lines will give you a variable named "result" with a value that is a random number between 30 and 130.
Put his code in your script with a wait call using the variable "result" as its parameter. You will then wait a random number of seconds between 30 and 130.Code: Select all
Random>101,result Add>result,30
Total code will look something like this:Code: Select all
Wait>%result%
Code: Select all
Label>Start //Your current code Random>101,result Add>result,30 Wait>%result% Goto>Start
Hope this helps.