Total Pageviews

Saturday, September 17, 2005

Playing with Features of FMPro Version 8 [Saving Files with variable names and paths]

Here is a good tip from FileMaker’s Famous Andrew Lecates explaining how to save a file to a specific path.
This is one of the new features in version 8 which was previously possible only with the aid of a plug-in.

1. Set a script variable to the path as a text string.
3. Enter the variable in the path dialog to 'carry' a calculated path
there

For step 1, use a script step like this:
  Set Variable [$filePath; Value: "file:" & Get(DesktopPath) &
    customer::first & "_" & customer::last &
    ".pdf" ]

This will result in a path string that places a .pdf file on your
desktop, and names the file based on the current customer record in
the form "Fritz_Jung.pdf".

For step 2, something like:
  Save Records as PDF [Restore; "$filePath"; Automatically open;
Current record]

So in the Specify Output File dialog, you would enter "$filePath" (no
quotes) into the Output File Path List.

FWIW, when doing this with scripts, I highly recommend using local
script variables [$filePath] over global script variables [$
$filePath] unless you want to make extra work for yourself cleaning
up the global variables and testing to make sure multiple scripts
using the same $$filePath aren't clobbering (writing over) each
other's output.

Enjoy!