Applescript: How to paste RTF on clipboard to email on Apple Mail?
12:06 20 Mar 2018

I made an Alfred workflow to convert my markdown (.md) notes to RTF and automatically add to my clipboard using pandoc in a bash script. Now that my notes are on the clipboard I want to offer the option to paste the RTF in the clipboard into a new email with the Alfred workflow. Alfred runs osascript so I have been using the Script Editor on Mac to create my script. I have this so far:

set clipContent to the clipboard

tell application "Mail"
    set newMessage to make new outgoing message with properties {visible:true, subject:"[NOTES] "}
    make new cc recipient at newMessage with properties {address:"EmailAddress"}
    set newMessage's content to clipContent
    activate
end tell

But I get this error message

Mail got an error: Can’t make {«class RTF »:«data RTF

Any suggestions on what is happening?

Thanks

M

applescript rtf pandoc