2

So my script is as follows:

SET !ERRORIGNORE YES
SET !ERRORIGNORE YES
SET !TIMEOUT_TAG 1
SET !TIMEOUT_STEP 1
SET !TIMEOUT_PAGE 30
SET !REPLAYSPEED FAST
TAB T=1
URL GOTO=http://www.youlikehits.com/stats.php
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.youlikehits.com/YLHicons/yt50.png
TAG POS=1 TYPE=A ATTR=TXT:View
TAB T=2
WAIT SECONDS = 35
TAB T=1

Instead of the "Wait Seconds= 35" I would like it to wait a random number between 35-45 seconds. I would really appreciate it if you would edit this script. I researched a lot and still did not understand how to do it.

user3423662
  • 21
  • 1
  • 2

3 Answers3

0

Here is an example how to use iMacros and JavaScript scripting.

Loop in Imacros using Javascript

And here is how to create random number in JavaScript.

Generating random whole numbers in JavaScript in a specific range?

A part of the code would look like this:

//generate random time
var time=getRandomInt(35,45);

//set the time to macro and play
iimSet("time",time)
iimPlay(macro)


/**
 * Returns a random integer between min and max
 * Using Math.round() will give you a non-uniform distribution!
 */
function getRandomInt (min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
Community
  • 1
  • 1
edinvnode
  • 3,497
  • 7
  • 30
  • 53
0
'set the delay lower limit, this can be changed
SET !VAR1 1800
'set the remaining time interval that need randomized
SET !VAR2 1800
'calculate the random number
SET !VAR3 EVAL("var randomNumber=Math.floor(Math.random()*\"{{!VAR2}}\" +\"{{!VAR1}}\"); randomNumber;") 
WAIT SECONDS={{!VAR3}}
vahed mafi
  • 84
  • 1
  • 8
-1

SET !VAR1 EVAL("Math.floor(Math.random()*45 + 35);")

WAIT SECONDS={{!VAR1}}

123
  • 1