Last active
May 15, 2019 20:52
-
-
Save kevin-funderburg/a8c8c3b00e666e7f30c3a56a38159efc to your computer and use it in GitHub Desktop.
Very useful, pastes the title of the front Safari window with the link to the page embedded.
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
| on run | |
| set strLinkHTML to "" | |
| tell application "Safari" | |
| tell front window | |
| tell current tab | |
| set strNameTabUrl to URL | |
| set lstNameTab to name | |
| end tell | |
| end tell | |
| end tell | |
| -- NAME AND URL AS HTML LINK | |
| if length of lstNameTab > 1 then | |
| set strLinkHTML to "<a href=\"" & strNameTabUrl & "\">" & lstNameTab & "</a>" | |
| end if | |
| -- REWRITTEN AS RTF AND COPIED TO THE CLIPBOARD | |
| set strCMD to "echo " & quoted form of strLinkHTML & " | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf" | |
| do shell script strCMD | |
| tell application "System Events" | |
| keystroke "v" using {command down} | |
| end tell | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment