I have built scripts that will save a PDF to the user desktop with a specific file name.
But what if I want to give it a name but let the user select the location?
Use a $Path variable to specify the name of the file and a standard location hidden from the user such as the temporary folder.
Use that $Path with Save As PDF to create the file and name it.
Use the $Path variable again with insert file to insert it into a container field. This can be a global container field.
Now use Export field contents to export the contents of the container with no $Path or file name specified.
The user should get a dialog where they can pick the location to which they save and the file's name will already be entered into the dialog.
Note, however, that the user will be able to change the file's name in this dialog if they choose.
Another way is possible. The dialogs are different, but the first method allows the user to change the specified file name if they choose. This method does not give them that option.
Get Directory [ $FolderPath ; "message to user here" ]
Set Variable [ $Path ; Value: $FolderPath & "FileNameHere.PDF" ]
Save Records As PDF [ $Path ]
Although somewhat annoyingly on macOS 10.11 (El Capitan) and newer, the Get Directory (along with Insert File) script step does not display a dialog title, even if one is specified, that would otherwise help guide the user.
For Mac users with macOS 10.11 or newer, I typically show a custom dialog prior to the Get Directory script step telling the user that they will now be asked to select a location...
The problem was noted here: https://community.filemaker.com/message/618754?commentID=618754#comment-618754
And in a KnowledgeBase article here: Custom title for system dialogs do not display as expected when using FileMaker Pro on OS X El Capitan (OS X 10.11) | Fi…
Retrieving data ...