Looping SELECT Entries by Index Number

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
squideshi
Posts: 1
Joined: Sat Dec 29, 2007 8:10 pm

Looping SELECT Entries by Index Number

Post by squideshi » Sat Dec 29, 2007 8:42 pm

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?
my2testing
Posts: 21
Joined: Tue Oct 30, 2007 6:57 am
Contact:

Post by my2testing » Tue Jan 08, 2008 8:38 am

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}}
Post Reply