Last active
January 29, 2016 17:27
-
-
Save Justin-Credible/0aa884c3a92a436db7d8 to your computer and use it in GitHub Desktop.
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
-- Variable Declarations -- | |
set title to "Chrome Development Launcher" | |
set startScript to "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromeDev" | |
set args to "--user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromeDev --args --ignore-certificate-errors --disable-web-security --use-spdy=off --remote-debugging-port=9222" | |
set endScript to "> /dev/null 2>&1 &" | |
set defaultProxySocket to "127.0.0.1:8888" | |
-- Prompt user to use proxy. --- | |
set useProxyPrompt to display dialog ¬ | |
"Use Proxy?" with title title ¬ | |
buttons {"Yes", "No", "Cancel"} ¬ | |
default button 2 | |
set useProxyPromptResult to button returned of useProxyPrompt | |
if (useProxyPromptResult is "Cancel") then | |
error number -128 | |
return | |
end if | |
-- If user wants to use a proxy, then prompt for the ip/port combination. -- | |
if useProxyPromptResult is "Yes" then | |
set proxySocketPrompt to display dialog ¬ | |
"Enter proxy server IP." with title title ¬ | |
buttons {"OK", "Cancel"} ¬ | |
default answer defaultProxySocket default button 1 | |
set proxySocketPromptResult to button returned of proxySocketPrompt | |
set proxySocket to text returned of proxySocketPrompt | |
if (useProxyPromptResult is "Cancel") then | |
error number -128 | |
return | |
end if | |
set args to args & " --proxy-server=\"" & proxySocket & "\"" | |
end if | |
-- Prompt to see if the user wants to edit the arguments before launching. -- | |
set editArgumentsPrompt to display dialog ¬ | |
"Edit Arguments?" with title title ¬ | |
buttons {"Yes", "No", "Cancel"} ¬ | |
default button 2 | |
set editArgumentsPromptResult to button returned of editArgumentsPrompt | |
if (editArgumentsPromptResult is "Cancel") then | |
error number -128 | |
return | |
end if | |
-- Allow the user to edit launch arguments. -- | |
if (editArgumentsPromptResult is "Yes") then | |
set editArugmentsDialog to display dialog ¬ | |
"Edit the arguments to be used to launch Chrome." with title title ¬ | |
buttons {"OK", "Cancel"} ¬ | |
default answer args default button 1 | |
set editArugmentsDialogResult to button returned of editArugmentsDialog | |
set args to text returned of editArugmentsDialog | |
if (editArugmentsDialogResult is "Cancel") then | |
error number -128 | |
return | |
end if | |
end if | |
-- Concatenate the script parts and then execute them as a shell script. -- | |
set shellScript to startScript & " " & args & " " & endScript | |
do shell script shellScript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment