How to loop only a series of steps in iMacros

99封情书 提交于 2019-12-05 06:16:03

问题


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"


来源:https://stackoverflow.com/questions/17959454/how-to-loop-only-a-series-of-steps-in-imacros

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!