How to Stop iMacros JavaScript script?

2019-05-18 21:44发布

问题:

Each time I use loops inside iMacros script the script will not stop when I press Stop button. It just skips to another loop counter and continues.

So if I have one macro inside two loops like bellow:

while(counter < 10)
{    
    for(var i=0; i<10; i++)
    {
        iimPlay(macro)
    }    
}

I would have to press Stop couple of times until some error doesn't pop out or the counters don't stop. So how to avoid this and when I press Stop button once the script stops?

回答1:

add this:

main:{
while(counter<10)
{
for(var i=0;i<10;i++)
{
var ret=iimPlay(macro);
if (ret == -101){break main;} // abort script if user presses Stop button
}
}
}