How to play a loop on iMacros browser with VBS?

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
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
Gnr993
Posts: 4
Joined: Fri Sep 01, 2017 3:26 pm

How to play a loop on iMacros browser with VBS?

Post by Gnr993 » Fri Sep 01, 2017 3:32 pm

Hi.
When I run my scrips for a long period of time, I get memory leak and the software crashes.
Therefore, I want to use VBS to open and close the iMacros browser to prevent memory leak.
I know that the script should look like this:

Code: Select all

Set iim1= CreateObject ("imacros")
    iret = iim1.iimOpen()
    iret = iim1.iimPlay("‏‏name of the file.iim")
    iret = iim1.iimClose()
But it opens the software only for 1 loop.
I need it to play 1 loop, close the software, and then play the next.
shaves
Posts: 75
Joined: Tue Apr 29, 2008 6:50 pm

Re: How to play a loop on iMacros browser with VBS?

Post by shaves » Fri Sep 08, 2017 9:39 pm

I use visual basic (vba) and run loops with iMacros all of the time. I'm assuming that your file name changes each time. The code I use would look something like this

Code: Select all


do until (some condition)
      
     doevents

    Set iim1= CreateObject ("imacros")
    iret = iim1.iimOpen()
    iret = iim1.iimPlay(varFileName)
    iret = iim1.iimClose()

    varFileName = ""

    (go get new file name)

loop
Hope this helps........
Post Reply