Is there a way of embedding a clickable url into a Mail message contents ?
The return from the script below returns the web link as text.
I would like it to-be a clickable url.
What can I do to achieve this ?
set em1 to "valdelpucci"
set Sub to "Boat Show"
set vne to "The Docks"
set N1 to "Joe"
set Nen1 to "Joe Blogs"
set Nead1 to "joeblogs@yahoo.com"
set evt to "Boat Show"
set dte to "Monday, 2nd August"
set tme to "7.30pm"
set wb to "http://www.theboatshow.com/"
set cm1 to "Hi " & N1 & "," & return & return & "Will you come to the " & evt & " on " & dte & " in the " & vne & " at " & tme & ". All the details can be be found at " & wb & " " & return & return & "Cheers" & return & return & "Val"
tell application "Mail"
set newMessage1 to make new outgoing message with properties {subject:Sub, sender:em1, content:cm1, visible:false}
tell newMessage1 to make new to recipient at end of to recipients with properties {name:Nen1, address:Nead1}
save newMessage1
end tell
-----Hi Joe,
-----Will you come to the Boat Show on Monday, 2nd August in the The Docks at 7.30pm. All
----the details can be be found at http://www.theboatshow.com/
-----Cheers
----Val
Maybe this can help you a little. Embed your link in html, then convert it to an rtf-link, than paste it to the clipboard,
then insert the contents of the clipboard to the contents of the message.
I used this for creating rtf links for file aliases I see no reason that you should not be able to rework it to insert an http:// url instead of a furl. You must send an rtf formatted mail, but I guess you knew that from before.
Edit: I do not know what you do mean by automatically. I can’t get to the boat show by clicking on the inserted link from your script, having said that, I have problems with attachments not showing up as well, so
my Mail.app isn’t exactly the reference applet.
on rtfLink(anAlias)
-- totally stolen from http://www.macosxhints.com/article.php?story=20091002090934432
-- I have a shell file - rather compact, but I can't figure out where that leading zero comes from.
-- I'll come back and revise this one as well.
local _msglnk
set _linkText to extract_shortname_from(extract_filename_from(anAlias as text)) as text
tell application "Finder" to set _msglnk to URL of (anAlias as alias)
set startEcho to "echo "
set echoDelimiter to "'"
set html_1 to "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n<title>"
set html_2 to "</title>\n<meta name=\"Generator\" content=\"Cocoa HTML Writer\">\n<meta name=\"CocoaVersion\" content=\"1038.11\">\n<style type=\"text/css\">\np.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}\n</style>\n</head>\n<body>\n<p class=\"p1\"><a href=\""
set html_3 to "\">"
set html_4 to "</a></p>\n</body>\n</html>"
set echoCommand to startEcho & echoDelimiter & html_1 & _linkText & html_2 & _msglnk & html_3 & _linkText & 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
copy (the clipboard) to theResult
return theResult
end rtfLink
I fancied that when looking in my sent box, but thank you.
It was an interesting question anyway Val. Because If I enter an url manually into a new message, it doesn’t appear as clickable at all. But I’ll have a go in my sent box and see.
Edit: Using a webloc, If you had made a nice thumbnail of the page containing the webloc (haas has made a program for doing that), then you could get quite a nice link. “click the picture”.
Still nice summer night! (I wish I was a fisherman - stumblin on the sea.)
Here’s a good way to create a link. See my post #8here.
This link-creator creates a link that’s usable in many programs, including email. I like it because it creates an rtf link on the clipboard that you can paste almost anywhere. But the nice feature is that you input a word to represent the link, so you don’t have to show the full link… like I did above with the word “here”. When you send this link through email it’s clickable like normal. When creating the email you can hover your mouse over the word for the link and the true link is displayed. It works good. Maybe you’ll like it.
Do you mean like this: Click here to see your previous post? You didn’t mean that. Edit:If you did mean that, -I guess Hanks rtf-link was converted to a usual < a href = addr > “click here” < / a > when he pasted it into a MacScripter Edit Window.
By the way, I have made a nice little tool for inserting BBCode into a variety of editors, including Safari, which you can find here
I guess you have read the script you too, you just concatenate the link and the text to represent the link into an rtf-string which is then pasted as rtf to the clipboard, which you then can paste into a mail. The nifty thing is is that mail signatures is also rtf or webarchieve to be more precise, but still editable in TextEdit as rtf, so you can just past the link in there.,-So you could put such a link into the signature, and just choose to use that signature every time you would send a mail with a reference to that link.