how to run 3 .js from one .js withous stop?

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
frankhack1
Posts: 75
Joined: Fri Mar 20, 2009 9:12 pm

how to run 3 .js from one .js withous stop?

Post by frankhack1 » Thu Sep 19, 2013 1:46 am

I have this code...

Code: Select all

// >>>>>>>>>> X DIAS <<<<<<<<<<
iimPlay("CODE: URL GOTO=imacros://run/?m=mymacros1.js")
iimPlay("CODE: URL GOTO=imacros://run/?m=mymacros2.js")
Problem, is that it only plays the fisrst .js and when going to the next .js it stops, mymacro1.js and mymacros2.js have the same code, and if I play them separatelly the perfectly work.

Please advice
Tom, Tech Support
Posts: 3490
Joined: Mon May 31, 2010 4:59 pm

Re: How to run 3 .js from one .js without stop?

Post by Tom, Tech Support » Mon Sep 23, 2013 8:24 pm

Hi frankhack1,

I have no problem using this approach to run two consecutive .js scripts, so I suspect the issue is specific to your scripts.

Here's what I used to test:

Test.js:

Code: Select all

iimPlayCode("URL GOTO=imacros://run/?m=Test1.js");
iimPlayCode("URL GOTO=imacros://run/?m=Test2.js");
Test1.js:

Code: Select all

iimPlayCode("URL GOTO=http://www.iopus.com/");
Test2.js:

Code: Select all

iimPlayCode("TAB OPEN\nTAB T=2\nURL GOTO=http://www.alertfox.com/");
However, the drawback to this approach is that you cannot easily pass variable values to each separate .js script from the main calling .js script. Instead, you would need to write the values to a file and then read them into the sub-scripts, or use an approach like the one described in this post.

:!: Note
  • Using imacros://run/?m=script.js with URL GOTO is *not* officially supported. iMacros was not designed for this particular usage scenario, and there may be other side effects or things that do not work correctly with this approach, like the one posted here. As such, we cannot justify allocating additional resources at this time to investigate any anomalous behavior attributed to calling .js scripts in this manner. Please remember that if you want an effective, supported method for calling multiple .js scripts from within another script, you can do so with the iMacros Enterprise Edition.
Regards,

Tom, iMacros Support
therealt
Posts: 1
Joined: Sun Nov 23, 2014 5:00 pm

Re: how to run 3 .js from one .js withous stop?

Post by therealt » Sun Nov 23, 2014 5:05 pm

Tom, you mention that
the drawback to this approach is that you cannot easily pass variable values to each separate .js script from the main calling .js script
If I'm using iMacros Enterprise Edition to run a VBS script that runs a JS script in Firefox, how do I pass variable values from the VBS script to the JS script?
Tom, Tech Support
Posts: 3490
Joined: Mon May 31, 2010 4:59 pm

Re: how to run 3 .js from one .js withous stop?

Post by Tom, Tech Support » Fri Dec 12, 2014 1:54 pm

Hi therealt,

It's not possible to pass values directly to a .js script using the the iMacros scripting interface. iimSet only works for passing values to regular macros (either external .iim files or macro code you build in your script).

In order to pass values to a .js script you would have to do it externally, e.g. by writing those values to a file and then have your .js script (or a macro called by your .js script) read those values.
Regards,

Tom, iMacros Support
Post Reply