SuperUserMan
SuperUserMan

Reputation: 37

Imacros - Looping multiple macros specific number of times using Javascript

I play multiple Macros one after another, multiple times using a simply loop in javascript .js file as below

var i;
for (i = 1; i <= 10; i++)
{
iimSet("loop", i);
iimPlay("1.iim");
iimPlay("2.iim");
iimPlay("3.iim");
}

but within the loop, i want each macro to be played specific number of times.

Say 1.iim 4 times, 2.iim 4 times and 3.iim full 10 times How can i do that? I tried adding "if" statement within the "for" loop for each macro

Var i1;
if(i1 <=4)
{iimPlay("1.iim");
 i1++;}

But that didn't work :( TIA

Upvotes: 0

Views: 1363

Answers (1)

oiawo
oiawo

Reputation: 145

I would go with the "If" this way:

var i;
for (i = 1; i <= 10; i++) {
  iimSet("loop", i); //this will be run 10 times
  if(i<=4) {
    iimPlay("1.iim");//this will be run during the 4 first loops
  }
  if(i>4 && i<=8) {
    iimPlay("2.iim");//this will be run during the 4 next loops
  }
  iimPlay("3.iim"); //this will also be run 10 times
}

Upvotes: 2

Related Questions