Random Header/Script

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
pearshaped
Newbie
Posts: 2
Joined: Mon Nov 07, 2005 9:50 am

Random Header/Script

Post by pearshaped » Mon Nov 07, 2005 10:31 am

Hullo there. I have been reading through the posts in the beginner section and had a look through the .pdf manual regarding the Random Label/Header. I see advice was given some time ago to one forum member regarding running a script at random intervals, as below:

Label>start
Random>57,interval
Let>interval=interval+1
Let>interval=interval*60
Wait>interval
V
V
V
GoTo>start


I want to run a script that will run randomly between 1 and 90 mins. What figures do I need to change in the above script to achieve this, as I am unsure what the "Random>57,interval" and "Let>interval=interval*60" actually refer to? Is this the minutes?

Also I see there is an option to allow multiple instances of Macro Scheduler to run. I want to run 2 different scripts, randomly (say 1-90 mins) on the same web page. Is there a way to instruct MS to run one script at a time? that is the second script wont start running until the first script has finished , or make it so the second script just "misses a turn" if it tries to run when the first script is still running?

Thankyou, Josey

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Re: Random Header/Script

Post by Me_again » Mon Nov 07, 2005 4:43 pm

pearshaped wrote: I want to run a script that will run randomly between 1 and 90 mins. What figures do I need to change in the above script to achieve this, as I am unsure what the "Random>57,interval" and "Let>interval=interval*60" actually refer to? Is this the minutes?
Have you looked at the Help or Manual? These commands are well documented.

"interval" is a variable.

Random generates a number between 0 and the specified number, so to generate 1 to 90 use:

Random>89,interval
Let>interval=interval+1

Wait needs a number in seconds so that's why interval is multiplied by 60

pearshaped
Newbie
Posts: 2
Joined: Mon Nov 07, 2005 9:50 am

Post by pearshaped » Wed Nov 09, 2005 9:20 am

Thanks for that Me_again...I did look through the manual but its a long complex manual :D Just a quick question if I may...whats the "+1" represent in the Interval +1?

Thanks, Josey

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Nov 09, 2005 10:26 am

Interval+1 means exactly that: "interval plus one", or "add one to interval". It increments the value of interval by one. So:

Let>interval=interval+1

means:

interval takes the value of interval plus one.

Lets say interval was 1 to start with:

Set the value of interval to the value of interval plus one. The value of interval is 1, so we set the value of interval to 1 plus 1 which equals 2. So interval now holds the value 2.
MJT Net Support
[email protected]

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Nov 09, 2005 2:33 pm

...and the reason for adding 1 is that random generates numbers starting from zero, so if you want a random range starting at some number other than zero you have to add that number to the generated random number.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts