Skip to content

Instantly share code, notes, and snippets.

@jtbrough
Last active October 7, 2015 16:38
Show Gist options
  • Save jtbrough/3195120 to your computer and use it in GitHub Desktop.
Save jtbrough/3195120 to your computer and use it in GitHub Desktop.
Open current Safari page in Google Chrome
--
-- This script launches the current Safari page in Chrome (I use this for sites that require Flash).
-- It doesn't do anything to your clipboard, or use keyboard shortcuts (though it could be associated
-- with one using Keyboard Maestro or alike). It simply uses Safari's existing open in Chrome
-- functionality. It does require that the Develop menu has been enabled in Safari.
--
-- grab the current Google Chrome version number from the app bundle
tell application "System Events"
set version_str to (value of property list item "KSVersion" of contents of property list file "/Applications/Google Chrome.app/Contents/Info.plist")
end tell
-- set initial variables
set menu_name to "Develop"
set menu_item to "Open Page With"
set submenu_item to "Google Chrome.app (" & version_str & ")"
-- make it so
tell application "Safari"
activate
end tell
tell application "System Events"
tell process "Safari"
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
tell menu item menu_item
tell menu menu_item
click menu item submenu_item
end tell
end tell
end tell
end tell
end tell
end tell
end tell
tell application "Google Chrome"
activate
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment