The best way to go about this is to use both the Send Mail script step and the Save Record as PDF, but without the auto-create e-mail option checked. And control the path of the PDF for both creating it and attaching it to the email using a Variable.
This particular script will store the PDF in a Temporary Folder that will be cleared out when the machine is restarted, this will mean anyone on the network can use it without affecting each other, but you can point it to a location on your network if you want to store the PDF's. Also if you are using a Windows machine then change "filemac:" in the Variable to "filewin:", and you can also calculate the file name based on a field in the record if you require.
The script will look like this:
Got to Layout ["LayoutB"]
Set Variable [$FilePath ; "filemac:" & Get ( TemporaryPath ) & "FileName.pdf"]
Save Record as PDF [No dialog; "$FilePath", Current record]
#PDF has been created in the Temporary folder, now attach and send in email
Send Mail [To: $Email ; subject: ... ; "$FilePath"]
Got to Layout ["LayoutA"]
You will setup the Send Email script step as you did previously except when you click 'Specify...' for the Attachment you will input "$FilePath" as this will be the location the PDF was created.
And this should do the trick, do ask if anything in unclear.
I hope this help.
Orlando, you're a bon to mankind! I adapted the script you kindly offered and it works like a champ. Many thanks. Ironically, I discovered your earlier post to someone who had a similiar need and was in the process of adapting the script you offered to him when I got your reply in this thread. Very glad you're generous with sharing your expertise.
NO worries RayMentor, glad it all worked for you.
I did use the script and it did work xcelent, but.... i use a portable + windows xp on the street and the FM12 file reside on my place in a Mac. How should be the scrip to work from the XP, because from there it does not work, I got a msg "$FilePath.pdf" can't be used and I need the extension travel with de filename. I write to you from Montevideo, Uruguay. Thanks in advance for your help! Regards Alvaro.
total newb at this. Am using Filemaker 12 and have tried recreating the code above, however when I run it it gives an error message as follows
“Filename.pdf” could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.
Any clues as to what I am doing wrong.
I am using this to create a record of individual student progress and would like to be able to email the particular layout to parents.