1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Trying to shut down select Firefox profiles via Batch file

Discussion in 'General Scripting Chat' started by DeLaGarde, Mar 31, 2017.

  1. DeLaGarde

    DeLaGarde Newbie

    Joined:
    Mar 20, 2017
    Messages:
    34
    Likes Received:
    5
    Gender:
    Male
    Was hoping I would get a helping hand on what seemed like a simple task, but a task I have been unable to solve even after pouring some hours into it, namely: how to shut down selected Firefox profiles using a Batch file.

    I have a batch file that starts up a bunch of Firefox profiles and gets some iMacros running. Its great and saves me a lot of time.

    This script looks something like this, just longer:

    Code:
    :: OPEN PROXY 01
    
    start "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -p Proxy01 -no-remote "imacros://run/?m=YTMonster - Auto Start.iim"
    TIMEOUT /T 10 
    Now I'd want to make a script that will properly shut down (not force quit) the profiles that I launched from the above script. There's TASKKILL, but I don't know how to direct it to specific Firefox profiles, only how to close all Firefox instances in one go, and I'm not sure if this is the kosher way to close the browser that will not result in file corruption.

    An alternative way I thought of was to run a Shut-Down iMacro script, one that neatly closes down what I was doing and then the browser, but was unable to figure out a way of sending a command from my batch file to the browser profile that I want without attempting to open a new instance of said profile. Its easy to open a new browser and run an iMacro script, but less clear to me how to run automate the running of a script in an already open browser instance.

    How would one go about selectively shutting down some Firefox profiles? All and any help is appreciated!
     
  2. dotaboy

    dotaboy Registered Member

    Joined:
    Apr 1, 2015
    Messages:
    91
    Likes Received:
    8
    Gender:
    Male
    Location:
    127.0.0.1
    Home Page:
    Why not close the profile from iMacro script? You can set a WAIT for n seconds and then close this profile
     
    • Thanks Thanks x 1
  3. DeLaGarde

    DeLaGarde Newbie

    Joined:
    Mar 20, 2017
    Messages:
    34
    Likes Received:
    5
    Gender:
    Male
    HI dotaboy, thanks for the suggestion, but the wait time to when I want to close the profile is always very variable. It's not a steady or predictable value, so this method wouldn't be ideal for me.