Search code examples
loopswhile-loopimacros

Normally end While LOOP when not found tag in JS iMacros


var i = 1;
var s = "";
while (s !== "#EANF#") {    
    iimPlay("CODE:TAG POS={{i}} TYPE=A ATTR=CLASS:*isBlue* EXTRACT=HREF");
    s = iimGetLastExtract();
    window.alert(i+s);
    i++;
}

BadParameter: expected POS= or POS=Rwhere is a non-zero integer as parameter 1, line 1 (Error code: -911)

I'm playing around 6 hours and stuck. Why above script can't get extract HREF,

This while only stop work normaly without loop

iimPlay("CODE:TAG POS=1 TYPE=A ATTR=CLASS:*isBlue* EXTRACT=HREF");

Plese help me out.


Solution

  •  var i = 1;
    var s = "";
    while (s !== "#EANF#") {   
    
         iimSet("i",i)
        iimPlay("CODE:TAG POS={{i}} TYPE=A ATTR=CLASS:*isBlue* EXTRACT=HREF");
        s = iimGetLastExtract();
        window.alert(i+s);
        i++;
    }
    

    Use this code. You forgot iimSet.