LOOP

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
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

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
sdtony
Posts: 31
Joined: Tue Dec 13, 2005 6:15 am

LOOP

Post by sdtony » Sat Apr 29, 2006 7:16 pm

I'm trying to loop the Macro "ImageSave" 73 times. Within the macro lies another macro called "ImageSave2" that should loop 8 times then exits then starts the whole thing over. What is wrong with the following code? BTW - The script should run the macro "Cielo" only one time at the beginning of the code.

Set iim1= CreateObject ("InternetMacros.iim")
iret = iim1.iimPlay ("Cielo")
For m = 1 to 73
iret = iimInit ()
iret = iim1.iimPlay ("imagesave")
For n = 1 to 8
iret = iim1.iimPlay ("imagesave2")
Next
Next
Romain
Posts: 88
Joined: Wed Oct 26, 2005 3:42 pm

Post by Romain » Sat Apr 29, 2006 7:40 pm

Code: Select all

Set iim1= CreateObject ("InternetMacros.iim")
iret = iimInit ()
iret = iim1.iimPlay ("Cielo") 
For m = 1 to 73
iret = iim1.iimPlay ("imagesave") 
For n = 1 to 8 
iret = iim1.iimPlay ("imagesave2") 
Next 
Next
Must be OK :wink:
Romain (French)
Configuration: Windows XP Pro SP2, iOpus iMacros 5.20
sdtony
Posts: 31
Joined: Tue Dec 13, 2005 6:15 am

Post by sdtony » Sat Apr 29, 2006 8:50 pm

I'm getting the following Windows Script Host Error box:

Line: 2
Char: 1
Error: Type mismatch: 'iimInit'
Code: 800A000D
Source: Microsoft VBScript runtime error
Romain
Posts: 88
Joined: Wed Oct 26, 2005 3:42 pm

Post by Romain » Sat Apr 29, 2006 8:58 pm

Code: Select all

Set iim1= CreateObject ("InternetMacros.iim") 
iret = iim1.iimInit ()
iret = iim1.iimPlay ("Cielo") 
For m = 1 to 73 
iret = iim1.iimPlay ("imagesave") 
For n = 1 to 8 
iret = iim1.iimPlay ("imagesave2") 
Next 
Next 
There was an error in your syntax code!
Romain (French)
Configuration: Windows XP Pro SP2, iOpus iMacros 5.20
sdtony
Posts: 31
Joined: Tue Dec 13, 2005 6:15 am

Post by sdtony » Sat Apr 29, 2006 9:06 pm

THANKS!
sdtony
Posts: 31
Joined: Tue Dec 13, 2005 6:15 am

Post by sdtony » Sun Apr 30, 2006 4:56 am

oops.... when the following macro is loop played in the browser it correctly saves each of the 8 images:

VERSION BUILD=5100314
FRAME F=9
TAG POS={{!LOOP}} TYPE=IMG ATTR=HREF:http://*.jpg
ONDOWNLOAD FOLDER=* FILE=+_image_{{!NOW:yyyymmdd_hhnnss}}
TAG POS=1 TYPE=IMG ATTR=HREF:http://*.jpg CONTENT=EVENT:SAVEITEM
BACK

But when trying to play the same macro 8 times with the following vbs script it saves the FIRST image 8 times not each of the 8 images 1 time as it should:

Set iim1= CreateObject ("InternetMacros.iim")
iret = iim1.iimInit ()
iret = iim1.iimPlay ("Cielo")
For m = 1 to 73
iret = iim1.iimPlay ("image save")
For n = 1 to 8
iret = iim1.iimPlay ("image save2")
Next
Next
sdtony
Posts: 31
Joined: Tue Dec 13, 2005 6:15 am

Post by sdtony » Mon May 01, 2006 5:56 pm

When one uses a script to run a loop it should loop down the POS when using the following command in the macro that the script calls right?

TAG POS={{!LOOP}} TYPE=IMG ATTR=HREF:http://*.jpg

I need to download the 8 images on a webpage so the script is running the macro 8 times. But only the first image is being downloaded ..... 8 times.

What am I doing wrong?
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Tue May 02, 2006 9:57 am

Hi,

when you use the Play (Loop) button within iMacros, the program takes care of setting the !LOOP variable. When you loop from an external program or script, you have to take care of that yourself. iimSet() is your friend here.

Code: Select all

For n = 1 to 8
  iret = iim1.iimSet("-var_LOOP", CStr(n))
  iret = iim1.iimPlay ("imagesave2")
Next
Make sure that you change the variable name in the macro from !LOOP to LOOP.

Regards
---
Lasse Clausen, iOpus Support
Post Reply