Last active
May 3, 2017 03:14
-
-
Save ejisoo/7378f4f9d6137b691ceffb731bdfb737 to your computer and use it in GitHub Desktop.
Dump URLs of Safari tabs to TextEdit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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