AndrewJudd

HTML with applescript

Discussion created by AndrewJudd on Aug 13, 2017
Latest reply on Aug 18, 2017 by APIcoder

hi all, I use the below applescript to create emails using a solution. I wondered if it is possible to adapt it slightly so the new email is HTML and I can therefore include formatted text (in italic) into the email.

 

Any suggestions welcome. thank you.

 

 

 

 

-- tell application "FileMaker Pro"

set theMessage to cell "Message" of current record

set theAttachments to cell "Attachments" of current record

-- return-separated Mac:file paths

-- end tell

 

 

set attachmentList to {}

repeat with i in paragraphs of theAttachments

set theAttachment to i

set aliasAttachment to theAttachment as alias

set attachmentList to attachmentList & aliasAttachment

end repeat

 

 

set theMessage to theMessage

 

 

set additionalParagraphs to return & return

repeat (count attachmentList) times

   set additionalParagraphs to additionalParagraphs & return & return

end repeat

 

 

tell application "Mail"

   activate

   set newMessage to make new outgoing message with properties {content:additionalParagraphs & theMessage, visible:true}

   tell newMessage

       repeat with i from 1 to (count attachmentList)

           tell content

               make new attachment with properties {file name:item i of attachmentList} at after paragraph (i *2 )

 

 

           end tell

       end repeat

      

 

 

       save newMessage

end tell

end tell

Outcomes