if statement - imacros javascript if else not behaving as it should and more -
okay first off had perfect script, no way run else conditions had parlay in javascript scripts runs not intended.
const iterations = 100; // number of times loop (var i=0; i<iterations; i++){ iimset('iteration', ); iimplay('step1'); // part one, grabs varibles , sets up. var string = "error, invalid request."; var result = string.match(/error/i); // result == 'error'; if (result){ iimplay(step1'); // part 2 checks see if successful if not loop step 1 if goes on step 3 } else { iimplay('step2');}} // part three, last step , save extracts.
everything triggers not execute should. example. on "part one" call iim step1 set our varibles etc (where worked before javascript) , runs should perfectly. problem comes play on "step two, no matter if detects string or not still fireoff , re-loop shouldent.
part 3 when manipulate script make part 3 test it, when complete loops not update {{cols}} or !var1 should, thought fine.
anyhelp please, proud beg @ first been few days on obbessed point , need help, cant figure out on own.
you didn't explain question.
try out. if step1 macro has set !errorignore yes
in case macro returns value true when played.
try out model
var macro; macro ="code:"; macro +="tag pos=1 type=a attr=href:www.somelink.com extract=href"; var macro1; macro1 ="code:"; macro1 +="tag pos=1 type=a attr=href:www.somelink1.com extract=href"; var result=null; result=iimplay(macro); //error has negative value if(result<0) { //do } else { iimplay(macro1) }
also here have list of errors , explanation. http://wiki.imacros.net/error_and_return_codes
you can use this.
var result=null; result=iimplay(somemacro); if(result==-1001) { alert("error happened. error type: syntax error in xpath expression"); }
Comments
Post a Comment