June 2, 201510 yr I have a solution that creates an email with an attachment. We need to use Applescript to do this, not the default 'send mail' function, and I am having trouble getting the applescript to attach the attachment. What is strange is that some records, it works consistently, and other records it never works. Basically I save a PDF to the desktop, then send an applescript command to use that attachment. The desktop PDF always creates, the new mail message always creates with the recipient pulled from the fm database, but the attachment only sometimes attaches to the message. In FileMaker, I am setting a variable with the applescript code, then after running the applescript which calls the variable. the variable code is as follows ... "set theAttachment to " & Quote( $MacPosixPath & $filename ) & "¶set RecipientAddress to " & Quote ( estimate_CLIENTCONTACT__~fkclientcontact::email1 ) & "¶set RecipientName to " & Quote ( estimate_CLIENTCONTACT__~fkclientcontact::name_full ) & "¶ tell application \”Mail\” ¶set newMessage to make new outgoing message with properties {visible:true} ¶ tell newMessage ¶make new to recipient with properties {name:recipientName, address:RecipientAddress} ¶ tell content of newMessage¶make new attachment with properties {file name:theAttachment} at after the last paragraph¶end tell¶ end tell¶ activate ¶end tell ¶" The variable $MacPosixPath is defined earlier in the script as ... Substitute ( Right ($desktopPath ; Length ( $desktoppath) - 1 ) ; "/"; ":") and $desktoppath is simply defined as Get ( DesktopPath ) I have attached two images to this post showing the resulting applescript that is executed. One that works correctly and the second that does not work. In both cases the pdf is present on the desktop. They look identical ... stange for sure! thank you in advance!
June 2, 201510 yr What error message is returned when you perform the second code sample from the Script Editor?
June 2, 201510 yr Author there is never an error message, Applescript processes it correctly with no errors, just no attachment appears.
Create an account or sign in to comment