The commented out portion of the script was this block.
tell application "Safari"
try
if not (exists document 1) then error "No document is open."
set theURL to URL of document 1
try
get theURL
on error
error "The front document has no URL."
end try
set thisTitle to name of document 1
--activate
end try
end tell
repeat
display dialog "Enter a title for the link:" default answer thisTitle
set thisTitle to the text returned of the result
if thisTitle is not "" then exit repeat
end repeat
tell application "Safari"
try
-- encode every character to unicode: ᇗ
repeat with i from 1 to the length of thisTitle
set thisID to the id of (character i of thisTitle)
if i is 1 then
set theTitle to "&#" & thisID & ";"
else
set theTitle to theTitle & "&#" & thisID & ";"
end if
end repeat
set startEcho to "echo "
set echoDelimiter to "'"
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">
<title>"
set html_2 to "</title>
<meta name=\"Generator\" content=\"Cocoa HTML Writer\">
<meta name=\"CocoaVersion\" content=\"1038.11\">
<style type=\"text/css\">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
</style>
</head>
<body>
<p class=\"p1\"><a href="">
set html_3 to "\">"
set html_4 to "</a></p>
</body>
</html>"
set echoCommand to startEcho & echoDelimiter & html_1 & theTitle & html_2 & theURL & html_3 & theTitle & html_4 & echoDelimiter
set textutilCommand to " | textutil -convert rtf -inputencoding UTF-8 -format html -stdin -stdout"
set pbcopyCommand to " | pbcopy -Prefer rtf"
set entireCommand to echoCommand & textutilCommand & pbcopyCommand
do shell script entireCommand
set the target_file to the quoted form of the POSIX path of (((path to "ssnd") as string) & "Pop.aiff")
do shell script "afplay " & target_file
on error error_message
activate
display alert "Error Running Script" message error_message
end try
end tell