I have been successful in attaching a single image file to a Mail message using the code below. I am actually sending an image file path to Applescript as a parameter from REALbasic but I have coded the path in the first line of the code below so I could test run it from the Script Editor.
What I would like to do is attach more than one image file to the message but I can’t seem to get the syntax right. How would I modify the first line in the code below to accomodate more than one file path.
set fileAttachThis to "Macintosh HD:Users:terryfindlay:Desktop:bob.jpg" as alias
set fileList to {fileAttachThis}
set composeMessage to (a reference to (make new outgoing message ¬
at beginning of outgoing messages))
tell composeMessage
--with properties {address:addrVar, display name:addrNameVar}
make new to recipient with properties {address:"tfindlay@nethop.net"} --theRecipientAddress}
set the subject to "Invoice" --subjectvar
set the content to bodyvar
tell content
repeat with aFile in fileList
--make new attachment
make new attachment with properties {file name:aFile} ¬
at before the first word of the ¬
first paragraph
end repeat
end tell
end tell