How to loop only a series of steps in iMacros

2019-04-02 09:29发布

问题:

I have a 10 step iMacro script that is set to loop 500 times via the Play (Loop) button.

The thing is, I only want steps 5-10 looped. The partial goal is to avoid the "URL GOTO=" step.

Thank you for your time.

Here's what it looks like:

VERSION BUILD=8300326 RECORDER=FX
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 20
SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*13 + 6); randomNumber;")
TAB T=1
TAG POS={{!LOOP}} TYPE=INPUT:SUBMIT ATTR=VALUE:value
TAG POS=R1 TYPE=SPAN ATTR=TXT:text
WAIT SECONDS={{!VAR1}}

I want to loop only the last 3 steps of the script.

回答1:

In *.iim file you can't loop specific lines from code, use *.js file instead:

var rand = Math.floor(Math.random()*13 + 6);  
var macro = "CODE:SET !ERRORIGNORE YES" + "\n";  
macro += "SET !TIMEOUT_STEP 20" + "\n";    
macro += "TAG POS={{i}} TYPE=INPUT:SUBMIT ATTR=VALUE:value" + "\n";    
macro += "TAG POS=R1 TYPE=SPAN ATTR=TXT:text" + "\n";    
macro += "WAIT SECONDS={{rand}}";    
for(var i=0;i<500;i++)    
{
iimDisplay(i);    
iimSet("i", i);    
iimSet("rand", rand);    
iimPlay(macro);}

Save this code in a *.js file and hit the Play button (not the one with loop).



回答2:

Don't forget use add your macro here :

iimPlay(macro);} 

Change macro with your macro name, and use "" mark.. example :

"testmacro"


标签: loops imacros