0

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

1 Answer 1

2

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
}

Sign up to request clarification or add additional context in comments.

3 Comments

but i need to run every iim different number of times (as detailed in question)... not just 1 if will do? Can you kindly edit the answer for that. Thanks
Hello, I'm not sure I really understand what you mean. I edited the answer with what I believe will do, could you please give more details if this doesn't meets your needs ?
thanks but i needed 1st top run 4 times, 2nd to run 4 times too one after another and 3rd to run 10 times too. with your solution it runs 1st till 4 and then 2nd . Anyway i got help from you and understood and worked around it by removing the >4 & <=8 thing . Can you help with Regex ?...just posted a question. stackoverflow.com/questions/27152409/… Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.