Insert a loop inside a macro to repeat only a selected steps

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
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
spattewar
Posts: 2
Joined: Thu Dec 15, 2005 5:52 am

Insert a loop inside a macro to repeat only a selected steps

Post by spattewar » Thu Dec 15, 2005 6:13 am

Hi,

First thanks for reading my query.

In my macro I have lets us say 10 steps. first 5 does the login part and the rest 5 selects a account and download a file. Is it possible to run the last 5 steps inside a loop so that each time I can provide it with a different account and download the files.

Thanks for your support.
Regards,
$wapnil
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Thu Dec 15, 2005 3:58 pm

You can do this using the Scripting Interface:

Code: Select all

i = iimPlay ("LoginMacro")

For m = 1 to 5
   i = iimPlay ("DownloadMacro")
Next
This example is using VBS code, but it can be done in any Windows Scripting or programming language.
sdtony
Posts: 31
Joined: Tue Dec 13, 2005 6:15 am

Post by sdtony » Thu Dec 15, 2005 7:19 pm

what language would you use if editting a recorded macro in IM Pro browser?
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Thu Dec 15, 2005 8:42 pm

what language would you use if editting a recorded macro in IM Pro browser?
You will need the Scripting Edition for this. Then you can use any scripting language. VBS is very popular because it is already preinstalled on every Windows version and there is a lot of free documentation available.
David
Posts: 11
Joined: Wed Dec 14, 2005 1:19 am

Post by David » Sat Dec 17, 2005 2:21 am

Tech Support wrote:You can do this using the Scripting Interface:

Code: Select all

i = iimPlay ("LoginMacro")

For m = 1 to 5
   i = iimPlay ("DownloadMacro")
Next
This example is using VBS code, but it can be done in any Windows Scripting or programming language.
I create a VBS file with the loginmacro.iim in the standard Macros location. The VBS files is also in the Macros directory. When I try to execute the VBS file, I get the following error:

Script: c:\Program Files\InternetMacros\Macros\doit.vbs
Line: 1
Char: 1
Error: Type mismatch: 'iimPlay'
Code: 800A000D
Source: Microsoft VBScript runtime error

What am I doing wrong?
David
Posts: 11
Joined: Wed Dec 14, 2005 1:19 am

Post by David » Sat Dec 17, 2005 3:02 am

Ehhh, never mind. I guess your example was shorthand, and assumed I knew what I was doing. The following code ran without the error:

set iim1= CreateObject ("InternetMacros.iim")

i= iim1.iimInit
'If i < 0 Then msgbox iim1.iimGetLastError()
if i < 0 then objOutputFile.WriteLine("INIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastError())


i = iim1.iimPlay ("Login")

For m = 1 to 5
i = iim1.iimPlay ("DoSomething")
Next

I just cut and pasted the additions from some example in the Windows Scripting Host directory. I still don't know what I'm doing, but as long as it works, I'm happy.
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Mon Dec 19, 2005 9:32 am

I guess your example was shorthand,....
Yes, sorry about the confusion
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Mon Dec 19, 2005 9:34 am

PS: If you ever want to find out more about the Windows Scripting Host, we compiled some resources at http://www.iopus.com/guides/wsh.htm
Post Reply