Skip to content

Instantly share code, notes, and snippets.

@rex
Created August 15, 2018 15:46
Show Gist options
  • Save rex/29f117df5953c12f081b01a285fb2b2e to your computer and use it in GitHub Desktop.
Save rex/29f117df5953c12f081b01a285fb2b2e to your computer and use it in GitHub Desktop.
Applescript snippet to copy all URLs from all open tabs in front-most Safari window
------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/11/15 00:00
# dMod: 2017/11/15 00:03
# Appl: Safari
# Task: Put URLs of all tabs of the front window on the clipboard.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Safari, @Put, @URLs, @All, @Tabs, @Front, @Window, @Clipboard
------------------------------------------------------------------------------
tell application "Safari"
tell front window
if its document exists then
set AppleScript's text item delimiters to linefeed
set urlList to URL of its tabs
set the clipboard to (urlList as text)
end if
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment