Hi TigerkimYou need to set the path of the PDF you are creating in a Variable and use that path in both the Save As Pad script step and the Attachment option for Send Mail step.To do this when setting up the Save As PDF, there is an option 'Specify output file', click specify and type in the name of your variable [$FilePath] and then for the Send Mail step, under the Message text area there is a tick box of 'Attachment', tick this and input the variable name in the dialog that pops up.Below is how the script would look if you saved the PDF in the Temporary folder, this removed when you shut down the machine.#Got to Layout ["YourReport"]
Set Variable [$FilePath ; "filemac:" & Get ( TemporaryPath ) & "FileName.pdf"]
Save Record as PDF [No dialog; "$FilePath", Current record]
#PDF has been created, now attach and send in email
Send Mail [To:"email@example.com"; subject: ... ; "$FilePath"]
The above variable for file path is for use on a Mac, if you are windows based change 'filemac:' to 'filewin:'
I hope this helps
Thank you so much for your sharing your skillz with a newbie. It worked! I know that many users will definitely find this helpful.
My last question. How do I keep the SAVED PFD FILE in the FOLDER for future use. As you have
instructed, the file doesn't even appear in the folder.
Thanks again. And Happy New Year!
I have a related question:
1) Using FileMaker 10
2) Mac OS 10.6 and Windows
3) The database is used by multiple people in FileMaker over the internet by both PCs and Macs.
4) Here's is what I am trying to do:
We have a page on the database where multiple email addresses are entered. After the email addresses are entered, we are trying to make it so you can click on a button and FileMaker will automatically create a PDF of that page (the record in that specific layout) and email the PDF as an attachment through FileMaker to all of the recipients listed in the first sentence of this paragraph. People using Macs and PCs will be using this feature. In addition, they are accessing the FileMaker database over the internet and they are using FileMaker.
Thank you for your post.
Are the multiple email addresses in separate records? Or, are they all listed in a text field? If the latter, how are the addresses separated? If separated with a comma or semi-colon, depending on the email client, you should be able to send one email to the entire group.
The example by Orlando is correct (Thank you!). This should work for you, but since you are posting, I assume it is not working. What is happening?
Everything is working, but I had to make one button to send for people using Macs and another button to send for people using PCs. Is there a common path I can use to save the PDF that will work for both Macs and PCs?
You can combine the buttons into one by changing the calculation for the variable:
If ( Abs ( Get ( SystemPlatform ) ) = 1 ; "filemac:" ; "filewin:" ) & <path name> & <PDF file name>
Then reference the variable for the destination. This will then work correctly for Mac and Windows.
Thanks for a good, detailed reply.
It would have been a lot easier if the Dialog box for specifying the file to attach to the email actually had a note that you can use a variable here. That would have saved me an hour or two.