Skip to content

Instantly share code, notes, and snippets.

@florianeckerstorfer
Created August 31, 2012 09:43
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 florianeckerstorfer/3550918 to your computer and use it in GitHub Desktop.
Save florianeckerstorfer/3550918 to your computer and use it in GitHub Desktop.
Opens the current URL from Safari in Google Chrome
(*
Opens the current URL from Safari in Google Chrome
Sources:
- http://stackoverflow.com/questions/6007338/how-to-open-a-new-tab-in-background-in-chrome-using-applescript
- http://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/
*)
property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
end tell
if appIsRunning("Google Chrome") then
tell application "Google Chrome"
tell window 1
set newTab to make new tab with properties {URL:theURL}
end tell
activate
end tell
else
tell application "Google Chrome"
do shell script "open -a \"Google Chrome\""
set URL of active tab of window 0 to theURL
activate
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment