Run multiple instances of Firefox

do shell script "/Applications/Firefox.app/Contents/MacOS/firefox-bin -P TargetProfileName TargetURL > /dev/null 2>&1 &"
Substitue your required values for TargetProfilename and TargetURL as needed.
Multiple instances of this command can entered into an AppleScript and saved for resuse as needed.  The above command creates “windowless” processes.  I like to have a small browser window appear for each session launched by the script, so I use the syntax:
 do shell script "/Applications/Firefox.app/Contents/MacOS/firefox-bin -P TargetProfilename TargetURL &> /dev/null &"

I’ve found it helps to separate each command with a “delay 1” command in the script.  You may want to experiment with this depending upon your machine’s capabilities and the complexity of the TartgetURL you’re launching in each instance of the browser.

By incorporating browser plugins such as Greasemonkey, YSlow, and Firebug you can automate a wide range of web site testing scenarios.  This technique is also handy for scripting the automatic and schedule retrieval of data from web servers.  A couple associates use this for retrieving application server logs and the daily market data for their personal stock portfolio.

For Windows users, this shell script will accomplish similar results on WinXP:

save the following script as a Windows XP batch file.

This script includes a menu to choose between launching all configured profiles, a single profile/tab, the profile manager, or just exiting without doing anything.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@echo off
cls

set UserChoiceIs=

echo  Would you like to launch all available Mozilla Firefox profiles and tabs?.
echo      Select A, to launch all profiles and tabs.
echo      Select S, to launch a single profile with only 1 tab.
echo      select P, to launch the Mozilla Firefox profile manager.
echo      Select E, to exit (launch nothing).

set /p UserChoiceIs={a,s,p,e}
IF NOT "%UserChoiceIS%"=='' SET UserChoiceIs=%UserChoiceIs:~0,1%
IF /I "%UserChoiceIs%"=="a" GOTO ALLPROFILES
IF /I "%UserChoiceIs%"=="s" GOTO SINGLETAB
IF /I "%UserChoiceIs%"=="p" GOTO GETPROFILEMANAGER
IF /I "%UserChoiceIs%"=="e" GOTO ENDGOODBYE

:ALLPROFILES
REM echo you've selected to launch all profiles/tabs.
REM pause
start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -p 1stTargetProfile -no-remote
start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -p 2ndTargetProfile -no-remote
start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -p 3rdTargetProfile -no-remote
GOTO ENDANDEXIT

:SINGLETAB
REM echo you've selected to launch a single profile/tab.
REM pause
start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -p 1stTargetProfile -no-remote "about:robots"
GOTO ENDANDEXIT

:GETPROFILEMANAGER
REM echo you've select to launch the Mozilla Firefox profile manager.
REM pause
start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -p
GOTO ENDANDEXIT

:ENDGOODBYE
REM echo you've selected to exit
REM pause
exit

:ENDANDEXIT
REM echo Goodbye.
REM pause
exit
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s