Skip to content

Instantly share code, notes, and snippets.

@ejisoo
Last active May 3, 2017 03:14
Show Gist options
  • Save ejisoo/7378f4f9d6137b691ceffb731bdfb737 to your computer and use it in GitHub Desktop.
Save ejisoo/7378f4f9d6137b691ceffb731bdfb737 to your computer and use it in GitHub Desktop.
Dump URLs of Safari tabs to TextEdit
tell application "Safari Technology Preview"
set allWindows to every window
set resultText to ""
repeat with currentWindow in allWindows
set tabcount to number of tabs in currentWindow
-- log tabcount
repeat with x from 1 to tabcount
set tabName to name of tab x of currentWindow
set tabURL to URL of tab x of currentWindow
-- Markdown link format
set resultText to resultText & "[" & tabName & "](" & tabURL & ")" & linefeed as string
end repeat
end repeat
end tell
-- Dump all links
tell application "TextEdit"
activate
make new document
set the text of the front document to resultText
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment