Vet inte riktigt om jag ska posta det här under FileMaker eller AppleScript, men eftersom det inte är FileMaker-delen av scriptet jag har problem med så blir det här...
Från FileMaker Pro 10 vill jag skapa epostmeddelanden i Mail med följande AppleScript:
--tell application "FileMaker Pro Advanced"
tell current record
set theSubject to cell "company::comp_special_mail_subject_"
set theMessage to cell "company::comp_special_mail_message_"
set theRecipient to cell "company::comp_comm_invoice_email_to"
set theCcRecipient to cell "company::comp_comm_invoice_email_cc"
set theAttachments to cell "company::comp_special_mail_filepaths_"
-- return-separated Mac:file paths
set theSender to "PGM"
end tell
--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 & return & return
-- otherwise it jams it up against the text
tell application "Mail"
launch
set theSign to signature "michael"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theMessage}
tell newMessage
set message signature to theSign
if theSender is not "" then
set sender to theSender
-- optional; otherwise uses default email account
end if
make new to recipient at end of to recipients with properties {address:theRecipient}
if theCcRecipient is not "" then
make new cc recipient at end of cc recipients with properties {address:theCcRecipient}
end if
tell content
repeat with i in attachmentList
make new attachment with properties {file name:i} at after the last paragraph
end repeat
make new message signature with properties {name:"michael"}
end tell
save newMessage
-- send newMessage
-- remove the commenting on the line above to send immediately
end tell
end tell
-- bring FileMaker forward
activate
Allt funkar bra utom att det inte blir någon signatur i meddelandet. När jag skapar nya meddelanden i Mail manuellt infogas signaturen automatiskt. Kan det vara så att den auto-skapade signaturen raderas när content skapas i scriptet?
Jag har provat att infoga raden "set message signature to theSign" på en massa olika ställen, men utan önskat resultat.
Någon? Tack på förhand!