Page 1 of 1

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

Posted: Thu Dec 15, 2005 6:13 am
by spattewar
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.

Posted: Thu Dec 15, 2005 3:58 pm
by Tech Support
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.

Posted: Thu Dec 15, 2005 7:19 pm
by sdtony
what language would you use if editting a recorded macro in IM Pro browser?

Posted: Thu Dec 15, 2005 8:42 pm
by Tech Support
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.

Posted: Sat Dec 17, 2005 2:21 am
by David
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?

Posted: Sat Dec 17, 2005 3:02 am
by David
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.

Posted: Mon Dec 19, 2005 9:32 am
by Tech Support
I guess your example was shorthand,....
Yes, sorry about the confusion

Posted: Mon Dec 19, 2005 9:34 am
by Tech Support
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