Skip to content

Instantly share code, notes, and snippets.

@ottoradke
Created December 9, 2014 06:58
Show Gist options
  • Save ottoradke/ac57103263da3e2a6bf3 to your computer and use it in GitHub Desktop.
Save ottoradke/ac57103263da3e2a6bf3 to your computer and use it in GitHub Desktop.
Google Chrome Incognito Window
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set chrome_running to is_running("Google Chrome")
if chrome_running then
tell application "Google Chrome"
repeat with w in (windows)
if mode of w is "incognito" then
set index of w to 1
tell application "System Events" to tell process "Google Chrome"
perform action "AXRaise" of window 1
end tell
activate
return
end if
end repeat
end tell
tell application "Google Chrome"
make new window with properties {mode:"incognito"}
activate
end tell
else
do shell script "open -a /Applications/Google\\ Chrome.app --args --incognito"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment