It would be simpler to specify the temporary folder as the location for the generated PDF's. Files in this folder will be automatically cleared by your OS.
Get ( TemporaryPath ) can be used to compute the file path to your temporary folder.
You may find these links helpful:
Save as PDF in a script: Found Sets to PDF with unique file names
Learning more about $Path variables and how to use them: Exploring the use of a $Path Variable in Scripts
Thanks so much for your reply. The pdf files are currently attached to specific emails from student records using the variable name (individual student number). Would the Send Mail script step still be able to retrieve those pdfs for attachments? I am not sure how to set up a temporary folder; any help?
The temporary folder already exists on your computer. It's part of the standard set up on both mac and windows systems. The Get ( TemporaryPath ) function will return the path to that folder for you to use both for saving a PDF and for attaching a file to an email. But once you close down FileMaker, the files in that folder are not retained so there is no need for a "housekeeping" script for clearing out past PDF files.
Please review the links provided for more details on how to set this up.
Again, I really appreciate your help. However, I am still having trouble getting it to work. Here is what I have now:
Go to Layout [ “Information Check” (Student Records) ]
Enter Browse Mode
Go to Record/Request/Page
[ First ]
Set Variable [ $Path; Value:"file:"& Get ( TemporaryPath ) & $StudentNumber ]
Set Variable [ $Studentnumber; Value:Student Records::Student Number & ".pdf" ]
Save Records as PDF [ File Name: “$Path”; Current record ]
[ Document - Title: "Info Check"; Compatibility: Acrobat 5 and later ]
[ Pages - Number Pages From: 1; Include: All pages ]
[ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ]
[ Restore ]
Send Mail [ Send via E-mail Client; To: Student Records::Emails All calc; Subject: "IB Database Information Check"; Message: "Students and Parents of IB Sophomores and Potential Sophomores,¶¶Enclosed is a PDF file of the information that we currently have on file for your student. Kindly please check the information and send us any updates or changes that need to be made. It is essential that we keep the information up to date in order to communicate effectively with you throughout the year. ¶¶Thank you very much for your help in this matter.¶¶Brian Bentley, D.M.A.¶International Baccalaureate Coordinator¶Hillcrest High School¶7350 S 900 E¶Midvale, UT 84047¶¶801-256-5484¶fax 801-256-5483¶¶firstname.lastname@example.org"; Attachment: “$Path” ]
Go to Record/Request/Page
[ Next; Exit after last ]
Go to Layout [ original layout ]
I get this message (please see attached screen shot)
Can you see what I'm doing wrong?
In your script, $StudentNumber must receive a value before $Path receives a value as you are using that variable to compute the value for $Path. Your script does it the other way around and thus the student number is never part of the text assigned to $path.
I'd avoid using the $StudentNumber variable at all and just use this as the first step inside the loop:
Set Variable [$Path ; value: "file:" & Get ( TemporaryPath ) & Student Records::Student Number & ".PDF" ]
I think I found the Problem. Thanks so much for your help!!