Skip to content

Instantly share code, notes, and snippets.

@carlosonunez
Last active October 22, 2015 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosonunez/6358f2d69b586459aa87 to your computer and use it in GitHub Desktop.
Save carlosonunez/6358f2d69b586459aa87 to your computer and use it in GitHub Desktop.
(* Use this AppleScript to launch instances of Chromium under different profiles. *)
(* Download the latest Chromium build here: http://chromium.woolyss.com *)
(* Gets the latest Flash version from your PepperFlash manifest. *)
on getPepperFlashManifest()
set pepperFlashPathPosix to "/Library/Internet Plug-Ins/PepperFlashPlayer"
set pepperFlashPathPosixEscaped to "/Library/Internet\\ Plug-Ins/PepperFlashPlayer"
set pepperFlashManifestFilePathPosix to pepperFlashPathPosix & "/manifest.json"
set pepperFlashPluginFilePathPosix to "/Library/Internet\\ Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"
set pepperFlashPluginFile to POSIX file pepperFlashPluginFilePathPosix
set pepperFlashManifestFile to POSIX file pepperFlashManifestFilePathPosix
tell application "Finder"
if exists pepperFlashManifestFile then
set command to "echo --ppapi-flash-path=\"" & pepperFlashPluginFilePathPosix & ¬
"\" --ppapi-flash-version=\"`cat \"" & pepperFlashManifestFilePathPosix & "\" | grep \"version\" | tr -d ',\" ' | cut -f2 -d :`\""
do shell script command
else
error "I couldn't find " & pepperFlashManifestFilePathPosix & ". This means that you need to install PepperFlash first. Follow the instructions at http://chromium.woolyss.com/#flash to do this." number 1
end if
end tell
end getPepperFlashManifest
(* Set this to whatever you want. *)
property profileName : "Personal"
property profileFolder : "/Users/$USER/.ChromeProfiles/" & profileName
property chromiumFilePath : "/Applications/Chromium.app/Contents/MacOS/Chromium"
property commandCreateProfileFolder : "mkdir -p " & profileFolder
try
set pepperFlashCommandFlags to getPepperFlashManifest()
set commandOpenChromium to chromiumFilePath & ¬
" --user-data-dir=" & profileFolder & ¬
" " & ¬
pepperFlashCommandFlags & ¬
" > /dev/null 2>&1 &"
(* Enable during testing: display dialog "Command: " & commandOpenChromium *)
(* Create the folder if absent. *)
tell application "Finder"
if exists folder profileFolder then
(* NOOP *)
else
do shell script commandCreateProfileFolder
end if
end tell
(* Start Chromium! *)
do shell script commandOpenChromium
on error e
display alert e as critical
end try
@carlosonunez
Copy link
Author

I'm putting this here until I can push it into the right repo later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment