Description
This was originally published on the Red Sweater forum by Daniel Jalkut, and I have added it to the code library here! -- Justin: It takes the highlighted text and turns it into a link to the frontmost page in Safari, complete with the appropriate title tag.The Code
tell application "Safari"
set t to name of window 1
set s to URL of document 1
end tell
tell application "MarsEdit"
set u to selected text of document 1
set selected text of document 1 to "<a href="" & s & "" title="" & t & "">" & u & "</a>"
end tell
set t to name of window 1
set s to URL of document 1
end tell
tell application "MarsEdit"
set u to selected text of document 1
set selected text of document 1 to "<a href="" & s & "" title="" & t & "">" & u & "</a>"
end tell