help automating multiple imacros for firefox

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
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

help automating multiple imacros for firefox

Post by venn99 » Fri Feb 18, 2011 6:09 pm

Hello

I have a questions about imacros for firefox. I am pretty good and programming generally standard firefox macros, but when it comes to javascript and executing them with imacros in firefox or in macros alone, I really have no idea, but here is my question.

I have made hundreds of individual scripts for firefox. What I want to do is be able to execute them all on a loop at once. I want them all to open and run simeltaneously and I do not know how to do this. Bookmarks dont work, nothing really works that I have tried. I need a simple fast way of doing this. Task manager just seems ridiculously complicated. I am thinking of just recording a computer click macro of this, but I dont think it will work that well. Please let me know an easy way to do this thanks.
Volodath
Posts: 23
Joined: Mon Jan 17, 2011 11:32 pm

Re: help automating multiple imacros for firefox

Post by Volodath » Fri Feb 18, 2011 8:08 pm

Sounds like you're looking for a simple Batch file.

Open up a text file and put in something like this

ECHO OFF
taskkill /F /IM firefox.exe
SLEEP 4
START "C:\Program Files\Mozilla Firefox\firefox.exe" http://run.imacros.net/?m=<WAIT>.iim
SLEEP 4
START "C:\Program Files\Mozilla Firefox\firefox.exe" http://run.imacros.net/?m=<NAMEOFYOURMACROHERE1>.iim
SLEEP 4
START "C:\Program Files\Mozilla Firefox\firefox.exe" http://run.imacros.net/?m=<NAMEOFYOURMACROHERE2>.iim
...

Repeat as much as needed.

The first command will end all firefox browsers at are running; remove as necessary.

The 1st start command boots up the dummy window that will receive the next imacros command in the next start command

Sleep is a .exe file you'll need to download and put in the root of your windows folder; it simply pauses 4 seconds to let the browser boot up

The next Start command sends the command go start the macro of "nameofyoumacrohere" in the first browser

Sleep 4 pauses for 4 seconds

all following start commands will send the start macro command to the empty browser 'behind' it.
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Fri Feb 18, 2011 8:24 pm

hi i need the batch file to loop each macro to 5000 upon opening so it will have to set the max to 5000 unless you can loop it in the file before you start it in which case i am not sure
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Fri Feb 18, 2011 8:49 pm

if you can tell me how to loop the macro in the batch that would be great but i read that in other posts there is no syntax in batch files to actually loop it. someone had mentioned that you need to do something with javascript which i am not sure about to get it to loop so my next question is can someone tell me step by step how to do this with java or how to loop an already existing macro without having to manually enter the loop in the browser..

an example of one of my macros is below

VERSION BUILD=6650406 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
TAB CLOSEALLOTHERS
SET !DATASOURCE AECT.txt
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO={{!COL1}}
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:* ATTR=ID:edit-comment
SET !DATASOURCE back2.txt
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:* ATTR=ID:edit-comment CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:comment_form ATTR=NAME:op&&VALUE:Preview<SP>comment
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:comment_form ATTR=NAME:op&&VALUE:Post<SP>comment
Tom, Tech Support
Posts: 3529
Joined: Mon May 31, 2010 4:59 pm

Re: help automating multiple imacros for firefox

Post by Tom, Tech Support » Tue Feb 22, 2011 12:18 pm

Hi venn99,

You need to use Javascript to loop your macro in this case:

LoopMyMacro.js

Code: Select all

var i;

for (i = 1; i <= 5000; i++)
	{
	iimSet("loop", i);
	iimPlay("MyMacro");
	}
And you need to change all instances of {{!LOOP}} in your macro to {{loop}}:

Code: Select all

VERSION BUILD=6650406 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
TAB CLOSEALLOTHERS
SET !DATASOURCE AECT.txt
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{loop}}
URL GOTO={{!COL1}}
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:* ATTR=ID:edit-comment
SET !DATASOURCE back2.txt
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{loop}}
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:* ATTR=ID:edit-comment CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:comment_form ATTR=NAME:op&&VALUE:Preview<SP>comment
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:comment_form ATTR=NAME:op&&VALUE:Post<SP>comment
In addition to calling an .iim file from a batch file, you can also call a .js file using the same syntax Volodath showed earlier. But you can also write one JS file to call all of your macros sequentially, for example:

PlayAll.js

Code: Select all

iimPlay("MyMacro1");
iimPlay("MyMacro2");
iimPlay("MyMacro3");
iimPlay("MyMacro4");
// etc...
Regards,

Tom, iMacros Support
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Wed Feb 23, 2011 6:08 am

Hi

I am still having problems.

Using one js file to call multiple macros will only call them on a single loop so that doesn't help.

I have tried making an individual loop js for each macro, then made a batch file to call the js files each individually but when they do, only one of the firefox macros actually loops the others stop, so this is telling me the js file will no loop more than one at a time.

The solution I need is. Say I have 5 .iim's or macros like the one posted above. How can I loop each one to 5000 in different firefox windows simeltaneously?

The only that I have come up with out of all what you sent me is to make MULTIPLE js loop files for each macro, then batch them?\\

Is there not a js line in which I can loop all of my files at once rather than having to make multiple files and having to bat run each of them individually? I am thinking there has to be a simpler way than this.,
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Wed Feb 23, 2011 6:13 am

Also the bat file above from Volodath only explains how to loop macros not .js files

right now i am using

start firefox http://run.imacros.net/?m=1.js
start firefox http://run.imacros.net/?m=2.js
start firefox http://run.imacros.net/?m=3.js
start firefox http://run.imacros.net/?m=4.js

but then only one out of the whole group actually runs in loop the first ones just stop at the end of the .iim (this is after making an individual loop js for each macro and changing all the lines from !loop to loop as you explained earlier.

running each file seperately without other .js loops running they work but the moment you start running them all together, the last one you run will loop but the others will not.
Tom, Tech Support
Posts: 3529
Joined: Mon May 31, 2010 4:59 pm

Re: help automating multiple imacros for firefox

Post by Tom, Tech Support » Wed Feb 23, 2011 10:02 pm

If you want to play multiple Javascript macros concurrently, you need to use separate Firefox profiles. See this post for more information:

http://forum.imacros.net/viewtopic.php?f= ... 505#p31760
Regards,

Tom, iMacros Support
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Wed Feb 23, 2011 11:34 pm

those tutorials dont really explain how to start multiple firefox instances in different profiles

i managed to create the profiles, but have no idea how to launch hundreds of scripts in different profiles

what do i use javascript? how do i excute this what would the code be or at least for one so i can try and duplicate it to do many
Tom, Tech Support
Posts: 3529
Joined: Mon May 31, 2010 4:59 pm

Re: help automating multiple imacros for firefox

Post by Tom, Tech Support » Wed Feb 23, 2011 11:48 pm

Please see the Firefox online help:

http://kb.mozillazine.org/Command_line_arguments
Regards,

Tom, iMacros Support
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Thu Feb 24, 2011 12:03 am

i am aware of how to use the run function to start profiles

is what you are really trying to say there is no way to automatically run multiple profiles automatically then launch individual jscripts?, if so please be specific because individually starting profiles then individually starting hundreds of java scripts defeats the whole purpose of what i am trying to accomplish and just creates more work
venn99
Posts: 9
Joined: Fri Feb 18, 2011 5:52 pm

Re: help automating multiple imacros for firefox

Post by venn99 » Thu Feb 24, 2011 2:48 am

i managed to get a batch file to open different instances of single profiles to broswers, my next question is how do i open the .js file to run in the same instance of the browser/profile i have opened for each script?

if not the latter, how can i call all of my iim files in a java, script in loop but in different browsers, above you showed me how to call them but not in loop and in the same window, anything you can think of?
mrjjman
Posts: 18
Joined: Mon Apr 11, 2016 5:41 am

Re: help automating multiple imacros for firefox

Post by mrjjman » Fri Jul 29, 2016 2:09 pm

Hey guys,

Any help will be appreciated and maybe even compensated for :) I'm trying to create a js file that will call multiple macros and I need the data that's referenced from a csv in 1 of the macros to loop to the next line. So if I have Macro1.iim, Macro2.iim, and Macro3.iim, here is how I'm trying to set up the js file:

Macro1.iim runs, no looping needed and when finished, then proceed to next macro
Macro2.iim runs 5 times, data being input needs to loop, whereby the 1st run uses column 1, 2nd run uses column 2, etc, then proceed to next macro
Macro3.iim runs 2 time, but no data needs to loop. When this macro is done, this would be the end of the code

Machine info:
VERSION BUILD=8961227
Windows 7
iMacros for IE x86
Post Reply