Hi, my first post is a little bit long, but I spent some days in Google before posting here, so I hope to get help.
I am trying to create workflow using AppleScript that creates Mail message for me with some links in the footer of the mail body.
The problem is that I can't insert links this way, because it places this html as Plain text instead of Rich text:
set FooterText to "<a href=\"http://example.com\">Example link</a>"
I was trying to find a way to convert html text to Rich text, and found that it can be done with "textutil" from a Terminal app.
Running this command from Terminal app works fine:
echo '<a href="http://example.com">Example link</a>'|textutil -inputencoding UTF-8 -format html -convert rtf -stdin -stdout|LC_CTYPE=UTF-8 pbcopy
I can then open Mail app and paste "Example link" as a rich text, and this link is working.
However I can't do the same using "do shell script" from Applescript (NSAppleScript).
First I thought it is something to do with escaping characters, so I did a test with <b>bold</b>, but it didn't work, too.
Then instead of using "do shell script" I tried "do script" by telling application "Terminal" same script that was working in Terminal app, but it doesn't work from AppleScript, too:
on alfred_script(q)
set myHtmlText to "<b>bold example</b>"
tell application "Terminal"
do script "echo " & quoted form of myHtmlText & |textutil -inputencoding UTF-8 -format html -convert rtf -stdin -stdout|LC_CTYPE=UTF-8 pbcopy"
end tell
end alfred_script
Error msg says: "Expected end of line but found identifier." pointing to "|" before LC_CTYPE
Any ideas why it is not working?
Thanks in advance,
Romans