Loading imacros from batch 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
seagula
Posts: 1
Joined: Mon May 20, 2013 2:41 am

Loading imacros from batch firefox

Post by seagula » Mon May 20, 2013 2:51 am

I created a script that logs into one website and gets my earnings stats then paste it in my other websites from that emails myself. Everything appears to work mostly expect I have to leave firefox open with a website loaded.

Current batch looks like

Code: Select all

@echo off
start /wait firefox.exe - url imacros://run/?m=RXDash.iim
exit
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Wed Jun 26, 2013 4:46 am

Late reply, I hope you found a solution in the meantime..., see below the .BAT File I use (with Task_Scheduler) and that works pretty well...

Code: Select all

@ECHO OFF
ECHO
ECHO You have 30 sec to close this Window to prevent the Macro from running...
timeout 30
ECHO Start Firefox and wait another 30 seconds...
start /B "" "C:\Program Files\Mozilla Firefox\firefox.exe"
timeout 30
ECHO Now running the macro (in a 2nd Tab)...
"C:\Program Files\Mozilla Firefox\firefox.exe" imacros://run/?m="_My sexy Macro...++!.IIM"
rem Macro Execution completed
ECHO FINISHED!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
wviswildandwonderful
Posts: 21
Joined: Sat Aug 22, 2009 6:35 pm

Re: Loading imacros from batch firefox

Post by wviswildandwonderful » Fri Aug 09, 2013 5:08 pm

OH MY GOODNESS!!!

Thank you chivracq!!! I have searched wiki, this forum, google search, youtube.... EVERYWHERE. I tried every example given, finally after over a month I found this reply AND IT WORKS PERFECTLY!
There use to be an article by David poor to use javascript and batch file to do the same thng, BUT with upgrades to firefox a well as imacro's... the old code wouldnt work for me anymore! I had given up, until recently when I thought I'd try again to find a solution .. THANK YOU.

I modified it a bit to locate my firefox directory, but it did what it was suppose to! Now if I can get it to run one macro, then another... we will see. Again, THANKS!!!

EDITED.... OK, Im stumped. Ive tried start /wait, Ive tried all sorts of stuf I found on the internet, maybe Im not placing it correctly. Any help would be greatly appreciated!

When I use this code, it runs the one macro, in firefox flawlessly:

Code: Select all

    @ECHO ON
    ECHO
    ECHO You have 5 sec to close this Window to prevent the Macro from running...
    timeout 5
    ECHO Start Firefox and wait another 10 seconds...
    start /B "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
    timeout 10
    ECHO Now running the macro (in a 2nd Tab)...
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro1.iim" 

    rem Macro Execution completed
    ECHO FINISHED!
My goal is to run one macro, wait for it to complete and then run another, wait for it to complete then run another.....

such as (DOES NOT WORK):

Code: Select all

    @ECHO ON
    ECHO
    ECHO You have 5 sec to close this Window to prevent the Macro from running...
    timeout 5
    ECHO Start Firefox and wait another 10 seconds...
    start /B "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
    timeout 10
    ECHO Now running the macro (in a 2nd Tab)...
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro1.iim" 
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro2.iim" 
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro3.iim" 
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro4.iim" 
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro5.iim" 
    rem Macro Execution completed
    ECHO FINISHED!
The above code does not work. Any help would be GREATLY appreciated.

signed,
frustrated! (aka Tammy)
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Sat Aug 10, 2013 4:54 am

@WildAndWonderful => Happy I could help for 1 Macro...! (Never had anybody thanking me like you did...!)

For several Macros, from a Windows Shell perspective, it is like you are launching macro1 + macro2 + macro3 etc... nearly simultaneously... with for the least, Cookie hassle if all your Macros are for the same WebSite...
Either you must add some (large...!) artificial waiting time in your Batch File to allow Macro1 then Macro2 etc to complete, or you must launch all your IIM-Macros like in iMacros/Demos/Self-Test.js...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
garyst1981
Posts: 125
Joined: Tue Jan 15, 2013 1:01 am
Location: Philadelphia, PA
Contact:

Re: Loading imacros from batch firefox

Post by garyst1981 » Thu Aug 15, 2013 8:36 pm

is there a way to specify !LOOP to this way to launch the macro?
www.gustavorivera.com.mx
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Sat Aug 17, 2013 6:13 pm

garyst1981 wrote:is there a way to specify !LOOP to this way to launch the macro?
AFAIK, I think no, it's not really straightforwardly possible, which is a big pity... (ENHANCEMENT REQUEST...!!)

If your .CSV File uses only 1 column, you can consider using (ugly!) "horizontal" Looping, otherwise you need to code yourself the Looping with JS or VBS, I think... See discussion in the following Thread:
http://forum.imacros.net/viewtopic.php?f=11&t=21539
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
Mehmet
Posts: 5
Joined: Mon Nov 11, 2013 11:49 am

Re: Loading imacros from batch firefox

Post by Mehmet » Tue Nov 19, 2013 9:54 pm

How do I create a batch file that openes a imacro in a already opened tab without opening a new Firefox tab?

A program opens after every startup on my computer firefox with a configuration page automatically.
I need a batch file which openes a macro in the already (by the program) opened tab.

Code: Select all

start "" "C:\Program Files\Mozilla Firefox\firefox.exe"   imacros://run/?m=iatSky-config.iim
(batch) is opening a new tab in a new Firefox window...
In all chaos there is a cosmos, in all disorder a secret order.
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Sat Nov 23, 2013 3:33 am

Theoretically not possible I think, unless you can manage to be quicker than that other program and you start Firefox at Startup BEFORE the other program will launch Firefox (again). Like that your Macro runs in TAB1, you use a consequent WAIT to allow the other Program to load its page in TAB2 and you switch to TAB2...

(Dealing with Tabs is always quite a hassle with iMacros, it doesn't know Relative Tabs, otherwise with a TAB=R-1, it would be a piece of cake... There is already some Enhancement Request about that on the Forum...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
Mehmet
Posts: 5
Joined: Mon Nov 11, 2013 11:49 am

Re: Loading imacros from batch firefox

Post by Mehmet » Sun Nov 24, 2013 5:39 pm

Seems like a good idea. But the problem is - however Firefox makes it like this - that the macro is not running in a new tab, that macro (opened by batch in autostart [all users]) openes a new window. Is there a command like TAB=1, TAB=2... F.e. WINDOW=1 or WINDOW=2 (Firefox Window) like pressing [Alt] + [TAB]? I never saw any command like this and beside: why openes macro a new FF window? Absolutely unnecessary... and it sux... So maybe there's an option to prevent firefox (macros) opening a new window, only open a new tab? Thanx for answers :)
In all chaos there is a cosmos, in all disorder a secret order.
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Mon Nov 25, 2013 9:44 am

In my idea, you don't care if the Macro will be launched in a new Tab or in a new Window because the Firefox Instance for your Macro needs to be launched at Startup BEFORE (probably playing with "start /b /priority") the other Config Page and then you need to make sure that this Config Page is loaded in the same FF Window and not in a new Window...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
meauxmoney
Posts: 2
Joined: Sat Nov 23, 2013 6:26 pm

Re: Loading imacros from batch firefox

Post by meauxmoney » Sun Dec 08, 2013 6:27 pm

played with the script a little and this is what worked for me. Loading times vary, so just one of my scripts needed little more time to complete.
and another thing i had to set my firefox options up so that all new open windows are new tabs....
now im off to see this addon "tabmix plus" and see what it might do to help....https://addons.mozilla.org/en-US/firefo ... src=search

@ECHO ON
ECHO
ECHO You have 5 sec to close this Window to prevent the Macro from running...
ECHO Start Firefox and wait 5 seconds...
start /B "" "C:\Program Files\Mozilla Firefox\firefox.exe"
timeout 5
ECHO The next four pages will open in tabs provided that
ECHO Firefox is set to open new pages only in tabs..
"C:\Program Files\Mozilla Firefox\firefox.exe" imacros://run/?m="First.iim"
timeout 5
"C:\Program Files\Mozilla Firefox\firefox.exe" imacros://run/?m="Second.iim"
timeout 10
"C:\Program Files\Mozilla Firefox\firefox.exe" imacros://run/?m="Third.iim"
timeout 5
"C:\Program Files\Mozilla Firefox\firefox.exe" imacros://run/?m="Fourth.iim"
rem Macro Execution completed
ECHO FINISHED!
mbdawson
Posts: 2
Joined: Tue May 28, 2019 6:11 pm

Re: Loading imacros from batch firefox

Post by mbdawson » Tue May 28, 2019 6:13 pm

Does this still work with the most recent versions of Firefox? I cannot get a batch file to load a macro correctly. All it does is launch FireFox and then tries to search Google for imacros://run/?m="mymacro1.iim"
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Tue May 28, 2019 6:37 pm

mbdawson wrote:
Tue May 28, 2019 6:13 pm
Does this still work with the most recent versions of Firefox? I cannot get a batch file to load a macro correctly. All it does is launch FireFox and then tries to search Google for imacros://run/?m="mymacro1.iim"
Yeah, no need to post Duplicates when you want to post on the Forum... :shock:

FCIM...! :mrgreen: (Read my Sig..., and the Forum Rules...)

Not sure what "recent/latest VersionSSSSS of Firefox" you mean as you don't mention your FCI, but yep, the Syntax used in this Thread is not supported anymore (or not implemented yet...?) in v10.0.2 for FF, like documented in the Release Notes...
(And it's the only Version (for FF) where this Syntax doesn't work anymore, so I don't know which other "SSSS" Versions you mean, it works in v9.0.3 and v8.9.7, both for FF.)

It's all documented in the 'Release Notes' and in the Wiki where you have a (cumbersome!) Workaround mentioned in both, and several Threads on the Forum... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
mbdawson
Posts: 2
Joined: Tue May 28, 2019 6:11 pm

Re: Loading imacros from batch firefox

Post by mbdawson » Tue May 28, 2019 7:09 pm

Thank you.

The script works now with versions FF 55 and iMacros v8.9.7 for those with similar problems.
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loading imacros from batch firefox

Post by chivracq » Tue May 28, 2019 7:14 pm

mbdawson wrote:
Tue May 28, 2019 7:09 pm
Thank you.

The script works now with versions FF 55 and iMacros v8.9.7 for those with similar problems.
Yep indeed, that's "still" the "best" (= most workable + most functional) FCI, v8.9.7 still works (best) on FF v55.0.3, and FF55 Portable can also be used for Users who also want to keep a "parallel" FF66 (at the moment) FCI.
v8.9.7 for FF also works on Pale Moon for example (PM28) for Users who cannot use FF55 which is "slowly" becoming a bit old and doesn't get any Security Updates like PM does... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply