Page 1 of 1

How to loop from 1-20 or Higher

Posted: Sat Jun 03, 2006 8:29 pm
by davidoflondon
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

VERSION BUILD=304809
TAB T=1
TAB CLOSEALLOTHERS
ONDOWNLOAD SET !ERRORCONTINUE YES
SET !VAR1 http://www.website.com/images/
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

SET !VAR1 http://www.website.com/images/0

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

SET !VAR1 http://www.website.com/images/0
URL GOTO={{!VAR1}}{{!LOOP}}.jpg
SET !VAR2 http://www.website.com/images/
URL GOTO={{!VAR2}}{{!LOOP}}.jpg

This works but its painfully slow as ever loop it accesses a non-existant page.

Posted: Wed Jun 07, 2006 9:42 am
by Tech Support
Hi,

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.

Regards
---
Lasse Clausen, iOpus Support