Should running multiple iMacros in parallel work?

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
Puss
Posts: 18
Joined: Fri May 08, 2009 2:32 pm

Should running multiple iMacros in parallel work?

Post by Puss » Mon May 11, 2009 3:08 pm

Hi,

Questions:

Can multiple iMacros (js or Code) run in parallel in the same FF browser window or do *I* need to manage a queue for them?

If I have to queue them, how would I detect that a macro has finished running so I can start the next one in the queue? (from js in the web page)

Two cases:

1) Different macros called, with different names
2) The same macro called ie the same name

Scenario:

- I'm looking at calling the macros from the web page's javascript using either the http://run.imacros.net/?m=macroname.ext, or http://run.imacros.net/?code=BASE64EncodedMacroString syntaxes

- Macros may be called from javascript event handlers including timed events like setinterval/settimeout.

- At times, events will happen quicker than macros will run, so a second/third/.../Nth macro could attempt to start before previous ones have finished.

- The same macro name could be called again before it has finished if the same event fires quickly or if two events happen that trigger the same macro


Can I expect this to work or do I need to find a way of queueing the macro calls in javascript to execute them one after another?

If I need to queue them, how can I detect when a macro has finished running, so I know when to start the next one?

Thanks for any help.
Puss
Posts: 18
Joined: Fri May 08, 2009 2:32 pm

Re: Should running multiple iMacros in parallel work?

Post by Puss » Thu May 14, 2009 6:00 pm

From experimentation, the answer seems to be 'no running iMacros in parallel in a single FF browser window will not work'.

It looked like the most recent macro to be requested runs by cancelling any previous running macro.

Alternatives are, open another FF window for each additional macro or create your own queue.

Queue Options In General:

- Queue external to browser using the scripting edition
- Internal queue in FF scripting .js iMacro
- Internal queue in webpage js

Internal Page Queue:

Since macros are triggered by page events, the natural place to put the queue is in the page js.

Use a page js variable (eg var iMRunning = 0;) to track if an iMacro is running.

- Set iMRunning = 1 just before 'launching' the iMacro from the page
- Launch the iMacro using run.imacros.net/?.....
- Reset it using URL GOTO=javascript:iMRunning=0; **at the end of **each** iMacro you run**
- Use setTimeout() to 'poll' the queue waiting for iMRunning == 0 before launching the next iMacro

Improvements to the above welcome ;)
Last edited by Puss on Thu May 14, 2009 11:30 pm, edited 1 time in total.
Puss
Posts: 18
Joined: Fri May 08, 2009 2:32 pm

Re: Should running multiple iMacros in parallel work?

Post by Puss » Thu May 14, 2009 11:23 pm

The above is working in my test framework using:

URL GOTO=javascript:isiMacrosRunning('No')

as the last line of each macro.

The point to note is that a javascript function is used to set/unset/check a page variable. (The iMacros URL command might not work using just a variable as described above.)

To be honest ... I'm surprised this works at all :)
Post Reply