user992731
user992731

Reputation: 3520

loop imacro with js, pause for 20seconds, then start again

I have the following js code but cant figure out how to pause it for 20 seconds then start it back up at the last position it left off at. Any help would be great!!

var macro;
macro = "CODE:";
macro += "TAG POS={{i}} TYPE=BUTTON ATTR=CLASS:btn<SP>btn-small<SP>likebutton"    + "\n";
macro += "WAIT SECONDS=2" + "\n";
for(i=1;i<=5;i++){
if(i==5){
  macro += "WAIT SECONDS=15" + "\n";
 var i=6;
 iimPlay(macro);
}
iimSet("i",i);
 iimPlay(macro);

}

Upvotes: 0

Views: 1431

Answers (1)

edinvnode
edinvnode

Reputation: 3547

var macro;
macro = "CODE:";
macro += "TAG POS={{i}} TYPE=BUTTON ATTR=CLASS:btn<SP>btn-small<SP>likebutton"    + "\n";
macro += "WAIT SECONDS=2" + "\n";


var i=1;

while(true)
{

//pause each fifth loop
if(i%5==0)
{

iimPlay("CODE: WAIT SECONDS=20")

}
iimSet("i",i);
iimPlay(macro);

//increase counter
i++; 
}

This is the code that will loop infinite loop. Each fifth loop it will pause and wait for 20 seconds. Then it will move on from the next loop counter.

Upvotes: 1

Related Questions