3 Replies Latest reply on Oct 15, 2014 1:08 PM by philmodjunk

    Dynamically Naming a PDF

    mariomassidda

      Title

      Dynamically Naming a PDF

      Post

      Hi, I'm trying to  save a record as pdf with a name that change according with a field, I'm using filemaker pro 13 advanced, i followed this guide http://help.filemaker.com/app/answers/detail/a_id/7013/~/dynamically-naming-a-pdf 

      the file must be named Invoice XXXX where XXXX is the field Name and the desktop path is /C:/Users/Brunella/Desktop/ (I'm under windows 8.1 x64)

      so according  to the guide the script should be 

      "filewin:"& Get ( /C:/Users/Brunella/Desktop/ ) & Invoice::Name & ".pdf"

      but i get an error with "one of the path in the list" and I cannot save... any thought?

      thanks 

       

        • 1. Re: Dynamically Naming a PDF
          philmodjunk

          It should be

          "filewin:"& Get ( DesktopPath ) & Invoice::Name & ".pdf"

          not:

          "filewin:"& Get ( /C:/Users/Brunella/Desktop/ ) & Invoice::Name & ".pdf"

          this get function returns the file path to the desktop that is valid for the current computer and computer user account. Change user accounts or change computers and it will return a different file path that is valid for that context.

          You may find this thread on $Path variables and the script steps that can use them helpful:

          Exploring the use of a $Path Variable in Scripts

           

          • 2. Re: Dynamically Naming a PDF
            mariomassidda

            I tried with "filewin:"& Get ( DesktopPath ) & Invoice::Name & ".pdf" but I got the same error that's why I thought to try with my real path since I'm the only user of the PC and filemaker  run only there so desktop is always in the same path, I had  a look at the link you posted.. I see there's a file to extract the correct path I cannot try it now, but I think the path is correct since I'm using it right now to save pdf and manually  renaming them after  creation. Desktop is not a priority I can put the pdf in a folder if that's  the problem in that case should I change DesktopPath with another path? I read about DesktopPath here http://www.filemaker.com/help/12/fmp/html/func_ref2.32.27.html seems written without spaces Get(DesktopPath)  I'm totally newby at this stuff so any additional advice will be helpful.

            • 3. Re: Dynamically Naming a PDF
              philmodjunk

              Desktop is the best location to specify for saving a PDF when you are having trouble since this is a location to which the user is nearly guaranteed to have "write" access privileges. I don't think this is due to specifying the desktop folder as the location for the PDF save. More likely there is some other issue preventing it from working and the error message doesn't really do a good job of telling you what is the most likely thing to look for.

              If you want to use a literal path instead of the get function, just don't use the get function, just enter the path in quotes.

              Two main issues to check:

              The path specified in the variable may be incorrect in some small way. (one character wrong is all that this takes). This is where the file that I created in the other thread is useful. You can insert a PDF file from your desktop and then examine the different fields to see at least two different path expressions that will be valid for the inserted PDF and you can then compare that to what you have attempted to use here. You can even copy and paste the path from the field into your script. You need also confirm that the text in Invoice is text that creates a valid file name. Some characters, such as / are not permitted in a file name.

              That there is no file at the specified location with an identical file name that is already open on your computer. That will also prevent FileMaker from saving the PDF.