Selecting text and adding a hyperlink

Just fyi — this would be quick work with Keyboard Maestro, or any macro program.

Tho – perhaps I am missing something – it doesn’t look as if the scripting API gives access to the text selection ?

(It appears to expose only row selection, which is not really what you need, but I suppose you could still use the clipboard and textutil to build and paste an RTF encoded link)

Perhaps quickquick-ish… ?

(Not hard to see the appeal of widget-free Markdown at these moments … )

In the meanwhile, typing the url first, and then ctrl-clicking to choose Edit Link and get this:

does seem workable …

PS to speed the work up a bit, in case anyone does try that with something like Keyboard Maestro, an AppleScript incantation for building the RTF might look something like:

if (strURL is not "") and (strTitle is not "") then
	set strHTML to quoted form of ("<font face=\"helvetica\"><a href=\"" & strURL & "\">" & strTitle & "</a></font>")
	do shell script "echo " & strHTML & "  | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf"
end if