I would suggest having the script export the field contents to temporary folder. Using that temporary folder location as the static reference in the Send Mail dialog. That way it doesn't have any impact on your file storage structure.
[…] but there is no place in the Send Mail dialog I can see to specify that field, to indicate the file path of the file
Calculate a storage location, put it into a variable, then use this variable to first export your file (e.g. into the Temp folder which be deleted when you quit FileMaker), then to specify the path for the attachment:
Export the field? Not sure what you mean. Export the field in the record that has a file path in it?
Where do you export it to?
The documents will be stored in a folder somewhere on the users desktop (at least for now as it will be a single user solution for the time being).
Sorry for not fully understadning your instructions.
Oh I see what you mean.
Now I think I see what you meant. Similar to BKeizer.
I regularly use a script along the following lines to accomplish this:
Allow User Abort [ Off ]
Set Error Capture [ On ]
Set Variable [ $requestName; Value:Let( [
mainpath = "/defineTheLocationPath/" ;
name = "someText" & aCalculatedValuedBasedOnTheCurrentRecord (in my case, client name) ;
ref = anotherCalculatedValuedBasedOnTheCurrentRecord (in my case, record number) ;
extension = ".pdf" ;
$filepath = "file:" & mainpath & name & ref & extension ;
$imagepath = "image:" & mainpath & name & ref & extension ] ;
$filepath & "¶" & $imagepath ) ]
Perform Script [ “ PAGE SETUP_tall” ]
Save Records as PDF [ File Name: “$filepath”; Current record ]
[ Document - 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; No dialog ]
Send Mail [ Send via E-mail Client ; To: emailAddressFromCurrentRecord ; Subject: "yourTextAsRequired" & calculatedTextFromCurrentRecordAsRequired ; Message: "Dear(or other greeting) " & calcToAddNameFromCurrentRecord & ",¶¶" &
"Whatever message text you want to hardcode here.¶¶Regards (or other signoff),¶yourName¶¶"; Attachment: “$filepath” ]
The one modification on this script that I would add if you are only using the export to attach it to an email is to use temp folder so that it will auto cleanup when rebooting. It is very simple if you use the Get(TemporaryPath) function.
Set Variable [ $path; Get(TemporaryPath) & "my_temporary_file.jpg" ]
Hope this helps.
Thank you very much Ben. It will be a while till I start on this (if they even go witht he project, yet unknown).
I agree with you Ben, if there is no reason to keep the exported document outside of FileMaker. My business logic requires that I keep copies of documentation as it was supplied to clients, so I define a permanent storage location. I think it is extermely useful that FM provides readily for both approaches.
I agree too. This is a new client and they are not even so sure what they want. I'm coaxing requirements out of them to get an idea of what to estimate for the work. Trouble is that now they tell me I am not a "pre approved" vendor so I think that will be a bigger challenge than the coding (it's for the city). I'll let them figure it out, hopefully they resolve it because the city would have good potential, although their IT refuses to support FM. Anyway, the client is keen so perhaps they can figure out what I need to do to be "pre approved".
I love approval ... lol.