5 Replies Latest reply on Jun 25, 2012 12:47 PM by tweller860

    FileMaker 12 "Insert PDF" Script Step Error 3


      I am in the process of updating a container field built in FileMaker 11 to make use of the interactive content now available in FileMaker 12.


      To do that, I've written a script to export the field contents (the PDF file) to the temporary directory and then re-insert the PDF using the "Insert PDF" script step so that the content is interactive. I'm using variables to store the two file paths I need:

      $ExportPath = filemac:/Macintosh_HD/TempoaryPath/FileName.pdf

      $InsertPath = imagemac:/Macintosh_HD/TemporaryPath/FileName.pdf


      Originally, this process was to be run by the users in our Sales and Customer Service departments, but they started getting Error 3 - "Command is unavailable (for example, wrong operating system, wrong mode, etc.)" Since they are using iMacs and networked home directories, I blamed a file system permission setting as the source of the problem. I began to experiment with the script again today and now I'm starting to have the same issue running on a local account on a laptop. I've updated the script to export to desktop instead of the temporary directory but still get the same error.


      I am error trapping to verify that the "Export Field Contents" script step is successful before attempting to insert the exported PDF using the "Insert PDF" script step. When I changed the script to use the Desktop, the file definitely appeared on my desktop so I believe that the file does exist when Insert step is executed. Could it be as simple as adding a "Pause" script step?


      Has anyone else experienced this problem? The files are hosted using FiileMaker Server Advanced 12 on an XServe running Mac OSX Server 10.6. On the client side, i'm running FileMaker Pro Advanced 12 on a MacBook Pro running Mac OSX 10.6. Any assistance that can be provided would be greatly appreciated.


      Best regards,



        • 1. Re: FileMaker 12 "Insert PDF" Script Step Error 3

          TW may be a good trapper,


          Yes, I suggest adding a 2 second pause. You are dealing with an asynchronous activity. FMP hands of the creation and writing of the data to disk to the OS. If the OS is busy it can take awhile before the file is actually created and filled with the correct data. FMP doesn't have any feedback that the OS has completed its write operation or when the file exists with the current data.


          If you are using the same file name for the temporary file then just checking that the file exists is not sufficient. The asynchronous nature of the disk write is such that FMP writes a file, reads the file, writes a second file and on the second read gets part of the first file and part of the second. I had this happening. I added the 2 second pause and the problem went away. Your system(s) may require more or less time. I found 2 seconds worked for my systems.

          1 of 1 people found this helpful
          • 2. Re: FileMaker 12 "Insert PDF" Script Step Error 3

            Thanks for the insight.


            I tried adding the "Pause Script" step, but I didn't have any success.  I tried a 2 second, a 5 second and then a 10 second delay.  I didn't notice any difference.  When exporting the PDF to my desktop, I was able to see document icon appear on the desktop while the script was paused.  I assume that means the export is truly successful.


            I've attached my script to this reply in the event my error trapping isn't properly formatted.  I apologize in advance for the formatting.  I'm having trouble getting FM12 to print directly to PDF so I copied and pasted into a Word document so I lost some formatting.  Hopefully it's still readable.  Again, any help you can provide is greatly appreciated.


            • 3. Re: FileMaker 12 "Insert PDF" Script Step Error 3

              Todd --


              I think you are over thinking the problem.  I just tried repeating what you say you are doing and get the same error.


              But I think this is because the field on the layout is formatted (under the inspector, Data>Data Formatting ; optimize for 'Images').  If I switch it to Optimize for 'interactive content', then I get no error.  You can check this easily by simply right-clicking on the empty container field in Browse mode.  If 'Insert PDF' is greyed out, then you can't use a Script Step to achieve your desired result either.


              Maybe you have two copies of the field on your layout.  If so, give one a name under the inspector and precede your import step with 'Go to Object', so FileMaker Pro will know which copy of the field to insert into.


              In fact, do you need to export & re-import at all?  Maybe all you need to do is switch the formatting for the field on the layout and it will just work.  I think we assumed you tried that and didn't get what you wanted, but maybe not....


              -- Drew Tenenholz

              1 of 1 people found this helpful
              • 4. Re: FileMaker 12 "Insert PDF" Script Step Error 3

                You'll need to go to Inspector > Data > Data Formatting, and select Optimize for Interactive Content. Try inserting a file into a container field manually. If it's formatted for images, your choices will be Picture, QuickTime, Sound, and File. If it's formatted for Interactive content, your choices will be Picture, Audio/Video, PDF, or File. All other choices will be greyed out.

                1 of 1 people found this helpful
                • 5. Re: FileMaker 12 "Insert PDF" Script Step Error 3



                  Thanks for the help.


                  I had correctly formatted the field on my main data entry layout for interactive content, which would explain why the manually triggered script would work.  However, in my haste to be efficient (simplify the layout with only the fields needed for the process), I created a new layout to run my automated, looping script on and failed to double-check the field format settings when I did that.  As predicted, the "Insert PDF" option was grayed out.  As soon as I fixed it, the script worked as intended.


                  To answer your second question, we have users accessing the database via Mac OSX clients locally and Citrix clients remotely.  I ran into the same error (Error 3) for our Sales dept. and Customer Service dept. users, regardless of how they accessed the database or what I tried to do, when trying to insert the PDF directly.  I definitely had the field formatting correct so I know it wasn't that. My work-around was to allow the user to insert any document as a file and then clean it up on the backend with this automated process.


                  Again, thanks again for catching the simple thing I missed.


                  Have a great afternoon.