How do I go to step 2 with the iMacros loop? How to choose all other href?

advertisements

I have this iMacros code fragment

VERSION BUILD=7200328 RECORDER=FX
TAB T=1
URL GOTO=http://feedburner.google.com/fb/a/myfeeds
SET !LOOP 1
TAG POS={{!LOOP}} TYPE=A ATTR=HREF:http://feedburner.google.com/fb/a/dashboard?id=*
TAG POS=1 TYPE=A ATTR=TXT:Publicize
TAG POS=1 TYPE=SPAN ATTR=TXT:Socialize
TAG POS=1 TYPE=SELECT FORM=NAME:editFeedActionForm ATTR=ID:postFields CONTENT=$Title<SP>and<SP>Body
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:mainForm ATTR=VALUE:Save
TAG POS=1 TYPE=A ATTR=TXT:FeedBurner

The above script will extract hrefs that match the http://feedburner.google.com/fb/a/dashboard?id=* rule, and will try to navigate further on the page.

However there are two links on the page with the same stuff and I want to loop only odd values. Like 1,3,5,7 how to set a custom step value for loop?


...and I want to loop only odd values

The iMacros language itself is a descriptive language (similar to HTML) and does not contain conditional statements or anything fancy.

So instead of using the iMacros LOOP button, use the built-in Javascript scripting support of iMacros for Firefox to run the loop. Inside the loop you can call your macro with iimPlay (and use iimSet to define values).

Something like this should work:

iimDisplay("Start loop...);

for (i = 0; i < 100; i=i+2) {
    iimDisplay("Step "+(i+1));
    retcode = iimPlay("your macro name here");
    if (retcode < 0) {
        report += ": "+iimGetLastError();
        alert ( report );
    }
}
iimDisplay("complete");