Created
July 31, 2010 22:02
-
-
Save cowboy/502665 to your computer and use it in GitHub Desktop.
"Have every version of Firefox running simultaneously" AppleScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* Launch Firefox - v1.0 - 7/31/2010 | |
* http://benalman.com/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*) | |
-- Usage: | |
-- | |
-- In preparation, name each different version Firefox app you plan to run | |
-- appropriately, for example "Firefox 2.0.app", "Firefox 3.6.app", | |
-- "Firefox 4.0.app" (etc) and put them all in the same folder (by default, | |
-- OS X will auto-add the .app extension, so you probably won't need to). | |
-- | |
-- Open this AppleScript in Script Editor and save it as "Launch Firefox" (of | |
-- type "Application") in the same folder as your Firefox versions. Once saved, | |
-- rename it to "ProfileManager X.app" where X is the name of one of your | |
-- Firefox apps (for example "ProfileManager Firefox 4.0.app"). | |
-- | |
-- Run the AppleScript. In a few moments, the "Firefox - Choose Use Profile" | |
-- dialog should appear. Create one profile for each Firefox version, named | |
-- "Firefox 2.0", "Firefox 3.6", "Firefox 4.0" (basically, the same as the | |
-- app name, minus the .app). When done, click "Exit". You should only need to | |
-- do this step again if you install a new version of Firefox or rename an | |
-- existing version. | |
-- | |
-- Create one copy of this Applescript for each version of Firefox you have | |
-- Installed, named "Launch Firefox 2.0.app", "Launch Firefox 3.6.app", | |
-- "Launch Firefox 4.0.app" (the same as the actual app, but with "Launch " | |
-- prepended to the name). | |
-- | |
-- By using these "Launch" AppleScripts, you should now be able to run | |
-- multiple different versions of Firefox simultaneously without any issues. | |
-- | |
-- Note that you can launch a version of Firefox in "Safe" mode by changing | |
-- the "Launch" prefix to "Safe Launch". | |
set my_path to quoted form of POSIX path of (path to me) | |
set parts to do shell script "echo " & my_path & " | perl -pe 's#^(.*?/)([^/]+) (Firefox.*?)\\.app/$#$1•$2•$3#'" | |
set parts to split(parts, "•") | |
set bin to quoted form of (first item of parts & last item of parts & ".app/Contents/MacOS/firefox-bin") | |
if second item of parts is "Launch" then | |
set args to "-P " & (quoted form of last item of parts) | |
else if second item of parts is "Safe" then | |
set args to "-safe-mode -P " & (quoted form of last item of parts) | |
else | |
set args to "-" & second item of parts | |
end if | |
try | |
do shell script "open -a " & bin & " --args " & args | |
on error | |
display dialog "An error ocurred. Be sure that you've named the AppleScript properly!" buttons {"Close"} default button 1 | |
end try | |
on split(txt, delim) | |
set delim_orig to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to delim | |
set retval to text items of txt | |
set AppleScript's text item delimiters to delim_orig | |
return retval | |
end split |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment