Skip to content

Instantly share code, notes, and snippets.

@hanneskaeufler
Created June 1, 2016 19:25
Show Gist options
  • Save hanneskaeufler/4b94e292372639fde003729726500669 to your computer and use it in GitHub Desktop.
Save hanneskaeufler/4b94e292372639fde003729726500669 to your computer and use it in GitHub Desktop.
AppleScript to move all the open tabs in Google Chrome to Safari
tell application "Google Chrome"
set allUrls to {}
repeat with theWindow in every window
set urlsInWindow to {}
repeat with theTab in every tab of theWindow
set currentUrl to the theTab's URL
set urlsInWindow to urlsInWindow & {currentUrl}
end repeat
set allUrls to allUrls & {urlsInWindow}
end repeat
end tell
tell application "Safari"
repeat with aWindow in every list of allUrls
make new document
activate
repeat with aUrl in every string of aWindow
open location aUrl
end repeat
end repeat
end tell
tell application "Google Chrome" to quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment