How to loop from 1-20 or Higher

Information related to the use of iMacros for form filling and data upload.

Moderator: iMacros Moderators

How to loop from 1-20 or Higher

by davidoflondon on Sat Jun 03, 2006 1:29 pm

I've been trying to get IM to loop through images stored on a website which are numbered. For example numbered 1-20. Obviously the following simple macro will do the job

URL GOTO={{!VAR1}}{{!LOOP}}.jpg

Then run the loop. The problem is that the images are numbered with leading zeroes e.g. 01, 02, ... 09, 10, 11 etc.

So if I run the loop as above it skips the first nine images as it attempts to find images 1.jpg rather than 01.jpg etc.

I can easily get round that by amending the fourth line to read


But then it won't access images ten or above as it now tries to read them as 010.jpg rather than 10.jpg.

Currently the only way I can see to solve this is by running the macro twice, once for images 1-9 and once for images 10+. Is there any way to solve this in just a single macro?

Incidentally I did experiment with using the following block

URL GOTO={{!VAR1}}{{!LOOP}}.jpg
URL GOTO={{!VAR2}}{{!LOOP}}.jpg

This works but its painfully slow as ever loop it accesses a non-existant page.
Posts: 1
Joined: Sat Jun 03, 2006 1:19 pm

by Tech Support on Wed Jun 07, 2006 2:42 am


I do not see any way to do this in the macro language because this would require some if..then..else construct, which is not possible in iMacros macro language.

The only way I see is to use a batch file or script to do the logic and pass the right value to the macro. This requires, however, the PRO or Scripting Edition.

Lasse Clausen, iOpus Support
User avatar
Tech Support
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Return to How-To's and Examples for Form Filling

Who is online

Users browsing this forum: No registered users and 2 guests