Running a macro at "random" times (sample and ideas)

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

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

Running a macro at "random" times (sample and ideas)

Post by Dorian (MJT support) » Mon Jan 23, 2017 7:37 pm

Over the weekend I was asked how a macro can be scheduled to run at random times. Of course this is not what the scheduler is intended to do, so I set about thinking up a way of making it "pseudo-random".

The customer said his script took 4.5 minutes to run. My solution was to schedule the macro to run every ten minutes, and to have a random number generator at the start of the script. If the generator produced a 7, the script would continue. If it didn't, it would terminate.

This works, and it did exactly what our customer wanted.

I'm wondering if any community members here can think of a different way. It's always good to keep those creative juices flowing.

//Generate a random number between 1 and 10
Random>10,RandomResult
Let>RandomResult=RandomResult+1

//Optional.. show what number was generated
Messagemodal>You threw a %RandomResult%

//If it isn't 7, exit the script
if>RandomResult<>7
//Optional message for testing/playing purposes :)
Messagemodal>You didn't throw a 7, exiting
exit>0
endif

//If it *is* a 7, whatever comes next will still be executed...

  View Snippet Page
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Running a macro at "random" times (sample and ideas)

Post by CyberCitizen » Tue Jan 24, 2017 9:52 pm

I didn't have one like that but I did have a site where I generate a bunch of random fake logins for usenet trials.

Basically took the top 100 most popular first names & surnames, then run the random to choose names etc. Then every 3x days the script runs, creates an account using a few domain names that are pointed at mailnesia (temp throw away emails with auto activation links).

The random feature works well.
FIREFIGHTER

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