Page 1 of 1

Looping SELECT Entries by Index Number

Posted: Sat Dec 29, 2007 8:42 pm
by squideshi
I am using iMacros for Firefox 6.0.1.5 and attempting to loop through all entries in a SELECT element, by index number, using the following code:
SET !LOOP 0
TAG POS=1 TYPE=SELECT FORM=NAME:Jurisdiction ATTR=NAME:County CONTENT={{!LOOP}}
Despite "SET !LOOP 0" the macro seems to always give {{!LOOP}} a starting value of 1. The variable does increment properly after this; however, the first entry in the SELECT element, which has an index number of 0, is always skipped. I do not wish to skip the first entry.

The following code does work properly:
TAG POS=1 TYPE=SELECT FORM=NAME:Jurisdiction ATTR=NAME:County CONTENT=0
I assume that the "SET !LOOP" command does not allow !LOOP to be set to zero. Can someone please confirm this?

As a workaround, I considered modifying the "Current:" field in the "Repeat Macro" section of the "Play" tab on the iMacros sidebar before clicking "Play (Loop)"; however, the field is grayed out and can not be edited. Is this by design, or is there some way I can change this value?

Posted: Tue Jan 08, 2008 8:38 am
by my2testing

Code: Select all

TAB T=1     
TAB CLOSEALLOTHERS     
SET !LOOP 1
SET !VAR1 {{!LOOP}}
SET !VAR2 -1
ADD !VAR1 {{!VAR2}}
TAG POS=1 TYPE=SELECT FORM=NAME:Jurisdiction ATTR=NAME:County CONTENT={{!VAR1}}