Randomize One Wait Time

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Sam71
Junior Coder
Posts: 23
Joined: Tue Mar 12, 2019 10:10 pm

Randomize One Wait Time

Post by Sam71 » Wed Apr 03, 2019 2:34 am

Hi Agian!,

Is it possible to randomize just one wait time in a script between x & x amount of seconds?.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1384
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Randomize One Wait Time

Post by Dorian (MJT support) » Wed Apr 03, 2019 11:58 am

Yes. Use Random, and Wait. This will wait anywhere between 1 and 10 seconds.

Random>10,MyResult
Let>MyResult=MyResult+1
MessageModal>I will now wait for %MyResult% Seconds
Wait>%MyResult%
MessageModal>Well that was fun. :)


If you wanted it to wait anywhere from 0-1 seconds (in tenths) you could simply divide the result by 10.

Random>10,MyResult
Let>MyResult=MyResult+1
Let>MyResult=MyResult/10
MessageModal>I will now wait for %MyResult% Seconds
Wait>%MyResult%
MessageModal>Well that was fun. :)

MessageModal is only in there for informational purposes.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Sam71
Junior Coder
Posts: 23
Joined: Tue Mar 12, 2019 10:10 pm

Re: Randomize One Wait Time

Post by Sam71 » Fri Apr 05, 2019 6:30 am

Dorian (MJT support) wrote:
Wed Apr 03, 2019 11:58 am
Yes. Use Random, and Wait. This will wait anywhere between 1 and 10 seconds.

Random>10,MyResult
Let>MyResult=MyResult+1
MessageModal>I will now wait for %MyResult% Seconds
Wait>%MyResult%
MessageModal>Well that was fun. :)


If you wanted it to wait anywhere from 0-1 seconds (in tenths) you could simply divide the result by 10.

Random>10,MyResult
Let>MyResult=MyResult+1
Let>MyResult=MyResult/10
MessageModal>I will now wait for %MyResult% Seconds
Wait>%MyResult%
MessageModal>Well that was fun. :)

MessageModal is only in there for informational purposes.
Thanks Dorian!,

I will run a test script when I get time the weekend. As always I'm very grateful for your expertise!.

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