multi macro run via single call

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
gtester
Posts: 9
Joined: Wed Nov 08, 2006 8:04 pm

multi macro run via single call

Post by gtester » Sat Jan 13, 2007 10:37 pm

[Sorry. Posting got lost. Here's a summary. (Admin)]

How to call several instances of iMacros that shall run different macros?
Hannes, Tech Support

Post by Hannes, Tech Support » Mon Jan 15, 2007 3:30 pm

These two lines create and initialize an iMacros instance:

Code: Select all

Set iim1 = CreateObject ("InternetMacros.iim")
i = iim1.iimInit() 
All other lines then control this instance (called "iim1"):

Code: Select all

' setting variables
i = iim1.iimSet("-var1", "user")
i = iim1.iimSet("-tray", "")

' play macro
i = iim1.iimPlay("macro1")

' exit iMacros
i = iim1.iimExit()
This means: just add lines like the first two , but with new names for the instances, e.g.

Code: Select all

Set iim2 = CreateObject ("InternetMacros.iim")
i = iim2.iimInit() 
Set iim3 = CreateObject ("InternetMacros.iim")
i = iim3.iimInit() 
You may now control them by calling the Macros methods on them (and not on "iim1") : e.g. iim2.Set(), iim3.Play(), etc.


Best,

Hannes
gtester
Posts: 9
Joined: Wed Nov 08, 2006 8:04 pm

Post by gtester » Tue Jan 16, 2007 2:28 am

I tried that and it runs them chronologically basically when macro1 finishes it goes on to macro2 and so on.

Is there a way to set the commands that they all run at the same time in parallel, maybe I am missing something here, if so can you give me an example if an additional command is needed?

thanks
Hannes, Tech Support

Post by Hannes, Tech Support » Tue Jan 16, 2007 10:05 am

Ah, I see, I thought the question was about "how to control them separately".

But now for "parallel" action: This depends on the programming/scripting language you choose. If it supports threading, you may run the instances in parallel.


Hannes
who_me??
Posts: 12
Joined: Sat Feb 17, 2007 2:34 pm

Post by who_me?? » Tue Feb 27, 2007 2:06 am

Hanes that what you explaned, can it work in Firefox version of imacros??

IF can then i am not doing it good, so i would need little help!


Thanks!
Hannes, Tech Support

Post by Hannes, Tech Support » Tue Feb 27, 2007 2:01 pm

With the new scripting interface (beta/testing release) this also works for FF. Please cf. http://forum.imacros.net/viewtopic.php?p=6894
who_me??
Posts: 12
Joined: Sat Feb 17, 2007 2:34 pm

Post by who_me?? » Tue Feb 27, 2007 3:26 pm

OK i have instaled it and test works!

Now i need help how i can make it to run few macros one after another! Where i should make that and how!

Thanks!
Hannes, Tech Support

Post by Hannes, Tech Support » Wed Feb 28, 2007 11:01 am

Here's a minimal VBS script. To run several macros in sequence, simply add more iimPlay() commands:

Code: Select all

Dim iret
set iim1 = CreateObject ("InternetMacros.iim")
iret = iim1.iimInit ("-fx") '-fx for FF, empty for iMacros Browser

iret = iim1.iimPlay("mymacro")

'iret = iim1.iimExit() 'uncomment to close browser at end of script
Post Reply