Safari to Rich Text Link

Anyone have automation suggestions using only macOS standard apps (Automator, AppleScript) and/or TextExpander to create a rich text link from Safari? I would like to have the page name as the text and the URL as the link.

I am trying to find a solution on a managed system.

The answer depends on what “rich text” is on the system you’re using. If it’s HTML, make a TextExpander snippet that runs this AppleScript:

tell application "Safari"
	set theTitle to name of front document
	set theURL to URL of front document
end tell

get "<a href=" & quote & theURL & quote & ">" & theTitle & "</a>"

It will insert a link to the frontmost page in Safari. You should be able to change the last line if necessary to get some other form of rich text.

2 Likes

That did the trick. Thank you!