1 Reply Latest reply on Feb 26, 2013 12:05 PM by mikebeargie

    Choose export directory in a script

    pminich

      I don't know if I am being dim or that this is a real challenge.

       

      I am trying to let the user choose the directory that they will be exporting a series of PDFs that are stored in container fields. At the same time I need to rename the files because some of them may have identical names.

       

      So net/net - Is there a way to rename the files that are being exported programatically and let the user choose the actual directory that they are exported to?

       

      Pete

        • 1. Re: Choose export directory in a script
          mikebeargie

          If you want a surefire way of only ever exporting that PDF file to a directory, you can modify the name to include a serial value or time value as well. The rest is pretty easy.

           

          set up a field - table::gLocation (global text field)

          set up a value list of paths - (IE My Docs, Desktop, Share drive)

          script an export button with the following (assuming you are on the record to export):

           

          set variable $location from table::gLocation

          set variable $path:

             "file:" & 

             Case (

                  $location = "My Docs" ; Get(DocumentsPath);

                  $location = "Desktop" ; Get(DesktopPath);

                  etc....

             )

              & table::serial OR filter(Get(CurrentTimeStamp);"0123456789" ) OR Get(UUID) - filemaker 12 only

              & "_filename.pdf"

          Export Field Contents ($path ; table::container)

           

          Here's more about export field contents:

          http://www.filemaker.com/help/html/scripts_ref1.36.56.html