Skip to content

Instantly share code, notes, and snippets.

@vjk2005
Created August 18, 2018 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vjk2005/92b829adbb818c1f1348a91657bf09af to your computer and use it in GitHub Desktop.
Save vjk2005/92b829adbb818c1f1348a91657bf09af to your computer and use it in GitHub Desktop.
Get list of all open URLs in all Safari Windows and paste them into a new TextEdit document
tell application "Safari"
set windowCount to number of windows
set docText to ""
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
repeat with y from 1 to tabcount
set tabName to URL of tab y of window x
set docText to docText & tabName & linefeed as string
end repeat
end repeat
end tell
tell application "TextEdit"
activate
make new document
set the text of the front document to docText
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment