Created
August 31, 2012 09:43
-
-
Save florianeckerstorfer/3550918 to your computer and use it in GitHub Desktop.
Opens the current URL from Safari in Google Chrome
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
(* | |
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