How to loop from 1-20 or Higher

Information related to the use of iMacros for form filling and data upload.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team
Post Reply
davidoflondon
Posts: 1
Joined: Sat Jun 03, 2006 8:19 pm

How to loop from 1-20 or Higher

Post by davidoflondon » 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.
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Wed Jun 07, 2006 9:42 am

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