Skip to content

Instantly share code, notes, and snippets.

@John07
Last active October 25, 2017 08:45
Show Gist options
  • Save John07/4401082 to your computer and use it in GitHub Desktop.
Save John07/4401082 to your computer and use it in GitHub Desktop.
Open currently active Chrome tab with Safari. Can be used with Textexpander or as a service
--
-- open currently active Chrome tab with Safari
-- forked from https://gist.github.com/3151932 and https://gist.github.com/3153606
--
property theURL : ""
tell application "Google Chrome"
set theURL to URL of active tab of window 0
end tell
if appIsRunning("Safari") then
tell application "Safari"
tell front window
open location theURL
end tell
activate
end tell
else
tell application "Safari"
-- Safari not running, so start it
do shell script "open -a \"Safari\""
tell front window
open location theURL
end tell
activate
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
@John07
Copy link
Author

John07 commented Dec 28, 2012

Thanks to @timarnold and @prenagha

@John07
Copy link
Author

John07 commented Dec 28, 2012

if you add "close active tab of window 0 -- close active tab" after line 7, the script will close the currently active Chrome tab to avoid duplicated tabs across browsers.

@l-g
Copy link

l-g commented Feb 5, 2017

I have saved this script in ~/Library/Services/ but when I right click in Chrome on an empty space in a window it does not appear in the service menu. However, it is always (?) visible under  -> Services -> General. How can I make it visible in Chrome's context menu? It is much more readily available there.

Furthermore, I would like a script that allowed me to right click on a link in Chrome and offer me to open the link in Safari. That is, it should not be necessary to first load the page in Chrome before I can open it in Safari. Is that possible?

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