How to do step 2 with the iMacros loop? How to choose any other href?

I have this iMacros code snippet

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 retrieve hrefs that comply with the http://feedburner.google.com/fb/a/dashboard?id=* rule and will try to move further down the page.

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

+4
source share
2 answers

... and I want to use only odd values

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

So instead of using the iMacros LOOP button, use the built-in Javascript scripting support for iMacros for Firefox to start the loop. Inside the loop, you can call your macro using iimPlay (and use iimSet to determine the 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"); 
+4
source

Such simple arithmetic can also be done in iMacros:

 'Store the value of !loop in a variable SET !VAR1 {{!LOOP}} ADD !VAR1 {{!LOOP}} 'now !var1 = 2*!loop. Subtract 1 to get odd numbers. ADD !VAR1 -1 TAG POS={{!VAR1}} TYPE=A ATTR=HREF:http://feedburner.google.com/fb/a/dashboard?id=* 

Hello,

Marcia

+5
source

Source: https://habr.com/ru/post/1347706/


All Articles