I suggest posting the actual script.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
original post updated with script
I don't think your file path is valid.
Filemaker filepaths use / instead of \\ both in a $Path variable and stored in a "by reference" container field so there's no need to use a substitute function to turn / into \ like you do in line 9.
And the file path in line 10 should include the file extension.
If this is a "store a reference" container field, the full file path is stored in the container field, there's no need to use a text calculation like you have in line 10 to construct the file path.
If this is not a "by reference" container field, you need to export the field contents to a specified location such as the desktop or the temporary folder before attaching the file in the email.
You may find this thread and the "exploration" file you can download from a link in it, helpful: Exploring the use of a $Path Variable in Scripts
Figured it out.
manually attaching the exact file in the script did work.
The manual attchment of the file showed a reference that was relative to the location of the .fmp12 file and after many variations of the complete path c:\users... c:/users..., etc... none allowed the file to be attached.
Also when inserting an externally stored pdf into a container field the second value in the container field starts with pdf : which needs to be changed to file:Files/ProjectName/ and then it attaches the file correctly.