1 2 Previous Next 15 Replies Latest reply on Jun 18, 2014 9:50 AM by danieroux@me.com

    Filemaker pro not saving to PDF with script

    danieroux@me.com

      Title

      Filemaker pro not saving to PDF with script

      Post

           I hope someone can help me with this intermittent problem. I can't get filemaker to save a pdf to a file location with a script. I get the following message:

           "“temp.pdf” could not be created on this disk.  Use a different name, make more room on the disk, unlock it or use a different disk."

           I am the administrator and have full access to the disk.

           Here is a copy of the script:

      Set Variable[$PDF_path_and_filename; Value: Get(DocumentsPath)]

      Set Variable[$PDF_path_and_filename; Value: $PDF_path_and_filename & "temp.pdf"]

      Save Records as PDF[Restore;No dialog;"$PDF_path_and_filename";Current record]

           I am running this script with the checkbox "Run script with full access priviledges" checked.

            

           Any help would greatly be appreciated!!

        • 1. Re: Filemaker pro not saving to PDF with script
          philmodjunk

               You won't need to run the script with full access privileges.

               That error message simply means that something kept FileMaker from creating the new PDF file with that name. It then lists several possible reasons for why it might have failed. The most common source of error is a filepath and name that is invalid. From your script, that does not appear to be the case here.

               Is it possible that a file named "temp.PDF" already exists and is open at the time that this error occurs? Maybe due to creating multiple PDF's in the same looping script?

          • 2. Re: Filemaker pro not saving to PDF with script
            danieroux@me.com

                 Thank you so much for your feedback.

                 I normally get the filename from a field which combines a few text strings to make up a unique name. I kept on getting the problem and then removed my "created filename" and tried it with the temp.pdf name. The problem persisted. Temp.pdf doesn't exist in that directory.

                 This seems to be intermittent though. Sometimes the script would work perfectly and then at times it would give me the error.  Currently I have no idea what changes in the background.

                 Thanks again for your help!

                 Warm regards

            • 3. Re: Filemaker pro not saving to PDF with script
              philmodjunk

                   That doesn't answer my question as to whether you are using a looping script.

                   I suggest posting an actual copy of your script.

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Filemaker pro not saving to PDF with script
                philmodjunk

                     Also, please tell me what version of FileMaker you are using. The above filepath example does not work with some older versions of Filemaker.

                • 5. Re: Filemaker pro not saving to PDF with script
                  danieroux@me.com

                       Thank you again for your time. I am using Filemaker pro advanced version 13. Apologies, I am not sure what a looping script is.

                       Here is the whole script  as requested:

                       This is used to generate a requisition for diagnostic imaging. It first creates a string to get all who needs a copy assigned (Requisition Medication and CC Physician String too). I then print the layout and save it as a pdf. I also store this pdf in a container afterwards for future reference.

                  Print Diagnosic Imaging Request

                  #First get the medication list as well as the CC physician list

                  Perform Script [ “Requisition Medication and CC Physician String too” ]

                  Go to Layout [ “Diagnostic imaging requisition” (EMR Main) ]

                  Print [ ]

                  Set Variable [ $PDF_path_and_filename; Value:$PDF_path_and_filename & "Dropbox/Vernon practice/Private practice/Investigation requests/" & EMR Main::Forms Diagnostic imaging Pdf file ]

                  Set Variable [ $PDF_for_container; Value:"imagemac:" & $PDF_path_and_filename ]

                  Save Records as PDF [ File Name: “$PDF_path_and_filename”; Current record ]
                                      [
                  Document - Compatibility: Acrobat 7 and later ]
                                      [
                  Pages - Number Pages From: 1; Include: Specific Pages; Start Page: 1; End Page: 1 ]
                                      [
                  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 ]
                  Go to Layout [ original layout ]
                  Go to Field [ EMR Main::Req Diagnostic Imaging ]

                  Insert PDF [ “$PDF_for_container” ]
                  Go to Object [ Object Name: "Diagnostic imaging tab"

                       Warm regards

                  • 6. Re: Filemaker pro not saving to PDF with script
                    philmodjunk

                         A looping script performs the same set of instructions over and over again--usually they are enclosed inside the Loop--End Loop script steps, though there are other ways to loop a script.

                         I suggest replacing:

                    Set Variable[$PDF_path_and_filename; Value:$PDF_path_and_filename & "Dropbox/Vernon practice/Private practice/Investigation requests/" & EMR Main::Forms Diagnostic imaging Pdf file]

                    Set Variable[$PDF_for_container; Value:"imagemac:" & $PDF_path_and_filename]

                    with:

                    Set Variable[$PDF_path_and_filename; Value: Get ( DesktopPath )  & EMR Main::Forms Diagnostic imaging Pdf file]

                         and see if that works, leaving the PDF on your desktop.

                         If that does not work, try:

                    Set Variable[$PDF_path_and_filename; Value: "file:" & Get ( DesktopPath )  & EMR Main::Forms Diagnostic imaging Pdf file]

                         "imagemac:" is not the correct "tag" for a PDF file though it may work on Macs. "file:" is cross platform, the same tag works on both Mac and Windows systems, but my recent tests of Save as PDF on Windows platforms work without including any tag at all.

                         Once you can get that to work, you'll need a valid file path to your drop box folder. That must start, in Mac systems, with the volume name of the hard drive that contains this folder and then all the enclosing folders down to and including the ones in your current script's file path calculation.

                          

                    • 7. Re: Filemaker pro not saving to PDF with script
                      danieroux@me.com

                           Wow, thank you for the detail and suggestions. I will try it out. 

                           I just noticed that I forgot a script step I had in my script. Just before the dropbox path I had the following line:

                      Set Variable [ $PDF_path_and_filename; Value:Get(DocumentsPath)

                      Set Variable [ $PDF_path_and_filename; Value:$PDF_path_and_filename & "Dropbox/Vernon practice/Private practice/Investigation requests/" & EMR Main::Forms Diagnostic imaging Pdf file

                      I understand that this should get you the correct path to the documents folder irrespective of the platform. Do I have this correct?

                            

                            

                            

                            

                      • 8. Re: Filemaker pro not saving to PDF with script
                        philmodjunk
                             

                        I understand that this should get you the correct path to the documents folder irrespective of the platform. Do I have this correct?

                        On my Windows 7 computer, my Drop Box folder is not located inside the Documents folder.

                        • 9. Re: Filemaker pro not saving to PDF with script
                          danieroux@me.com

                               Thank you again for your time. I have been so busy at work that I am only getting to this now.

                                

                               Yes, you are right: Get(DocumentsPath) returns the path to the documents folder.

                                

                               I have tried what you suggested but this doesn't work. I even tried entering the filename with the total pathway using the mac pathway without any luck. I still get the same message. I tried using: 

                          Set Variable [ $PDF_path_and_filename; Value:"file:Macintosh HD/Users/DanieRoux/Documents/LETS_TRY_THIS.pdf" ]

                          Save Records as PDF [ File Name: “$PDF_path_and_filename”; Current record ]

                          and I also tried using 

                          Set Variable [ $PDF_path_and_filename; Value:"Macintosh HD/Users/DanieRoux/Documents/LETS_TRY_THIS.pdf" ]

                          Save Records as PDF [ File Name: “$PDF_path_and_filename”; Current record ]

                               I have also tried this with a "/" in front of the "Macintosh HD" but it still does not work (This is how Get(DocumentsPath) returns the line)

                               Saving this to the desktop with your suggestion also didn't work. 

                               We must be missing something here. I have found that the problem is INTERMITTENT with my original script. For some reason it just works sometimes and then on other times it doesn't. Earlier today it didn't work, I opened filemaker again and it worked ... really stuck here.

                                

                               Hope you have some ideas

                                

                               Warm regards

                                

                                

                          • 10. Re: Filemaker pro not saving to PDF with script
                            philmodjunk

                                 A useful thread that you might explore: Exploring the use of a $Path Variable in Scripts

                                 There's an exploration file that you can download from that thread that covers a lot of potential issues with file paths and scripting. One way that you can use that file is to insert a file from the folder where you want to save your PDF into the file's container field. Calculation fields will then show you the actual filepath to that file. Given the very picky details that can derail this, you can compare that path to what you are using to see if you can spot any discrepancies.

                                 But given the fact that it works intermittently from a path variable that uses quoted text to specify the same file name each time (as opposed to calculating a different file name each time), there are two possible issues to consider:

                                 a) If you save a PDF file successfully and have it open on your database. The next time that you run this script, you'll get this error because FileMaker won't overwrite an existing file of the same name if it is open by you or another user.

                                 b) the file might be damaged. If a) is not a possible factor here, run a recover on your file and see if the recover reports any issues and test your recovered copy--even if no problems are reported to see if it works where the original did not.

                                 Let me know if that resolves this issue. I only have one suggestion left if these don't work for you.

                            • 11. Re: Filemaker pro not saving to PDF with script
                              danieroux@me.com

                                   Thank you again for your help! I truly appreciate the time and effort.

                                    

                                   The problem has finally been solved. I re-installed the filemaker update. After this it has not repeated the problem. I have used it for two days now without any glitches.

                                    

                                   What was the final suggestion you kept in the locker?

                                   Warm regards

                              • 12. Re: Filemaker pro not saving to PDF with script
                                philmodjunk

                                     That you post a clone of the file to a file sharing site so that I could download and examine a copy of the database file. That can take a lot of time and is basically giving away free consulting so it was an option of last resort. wink

                                • 13. Re: Filemaker pro not saving to PDF with script
                                  danieroux@me.com

                                       Thank you so much for the offer! Your help has been fantastic

                                       So my database is back doing the same thing after working without a glitch for 3 days. 

                                       The intermittent nature of this problem makes we wonder if something on my mac is not perhaps blocking the scripting part to write files to disk. 

                                       The problem is definitely not there when I am doing things manually.

                                        

                                       You can let me know what you think.

                                        

                                       Warmest regards

                                  • 14. Re: Filemaker pro not saving to PDF with script
                                    philmodjunk

                                         Or perhaps you have user account permission issues on your Mac. You may want to run some utilities that check/fix account permissions and that confirm that your hard drive is healthy.

                                    1 2 Previous Next