How to loop from 1-20 or Higher
Posted: Sat Jun 03, 2006 8: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
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.
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.