5 Replies Latest reply on Sep 22, 2014 10:56 AM by jessicar

    open container data script button

    BorisKamp

      Title

      open container data script button

      Post

           Hi!

            

           I was wondering how to create a button to open the externally stored (open storage) container data which is PDF for now.

           I have searched on the internet and forums here but couldn't find a solution that I understood.....

           So shortly:

           I would like a button with a script that opens the pdf in my container field. the container data is set to store externally on the same drive as the FM database is stored.

            

           Thanks in advance!

        • 1. Re: open container data script button
          philmodjunk

               Export Field Contents can be scripted to export a copy of the file and open it. You'll need to specify a file name and a location for that copy in the export field contents script step.

               A $Path variable can be used to do that.

               See this thread for a Tutorial file used to help developers understand Container fields, $Path variables and the script steps that can use a $path variable: Exploring the use of a $Path Variable in Scripts

               If you've been to this thread already, please post back here with a more detailed description of what you are trying to do and exactly where you encounter difficulty.

          • 2. Re: open container data script button
            philmodjunk

                 Please post your reposnses and questions here and not in the thread to which I referred you. It is too old to return to recent items and thus I will not see your questions when you post to it unless I happen to see it by accident as was the case today.

                 Export Field Contents can open a file stored in a container field. If you select the check box for this option, the file will be opened by the default application specified in your OS settings for that file type. This will work regardless of the method used to insert the file, the storage options specified and whether or not the file was inserted with the "store a reference" option selected.

                 Files inserted with "store a reference" enabled via the Insert File method can also be opened if you double click the container field, provided that you did not optimize the field for interactive content. Such a file can also be opened via script using the Go to Field script step with the select contents option enabled. But please note the many ways that this can be kept from working for you.

            • 3. Re: open container data script button
              jessicar

              If you could please assist me too Phil I would be most grateful. I'm experiencing seemingly unexpected behavior. It's down to the basics for testing:

               

              My Objective: Use a script to open a file (PDF) from a container field

              My Setup: FMPA13 / Windows7 (for testing purposes this file is not shared or hosted FMS13 yet)

              My Container Specs:

                     
              • PDF
              •      
              • REFERENCE ONLY (Reference is assured by being controlled 2 different ways: By script that allows Reference only & Using field validation and getContainerAttribute function)
              •      
              • INTERACTIVE CONTENT is preferred, but I've tested both 'Interactive Content' and 'Images' and neither have been successful.
              •      
              • For testing purposes the file is local to my C drive


              I have combed the internet, and this is the unexpected behavior:

              "Files inserted with "store a reference" enabled via the Insert File method can also be opened if you double click the container field,  provided that you did not optimize the field for interactive content." My file will not open when I double click even when set to "Image" and the reference is removed and re-inserted anew. What does that signal? Does it help identify the problem? " Such a file can also be opened via script using the Go to Field script step with the select contents option enabled." This does nothing, even more odd is the fact that I don't get an error code either.  " But please note the many ways that this can be kept from working for you."

              Any ideas? I've uploaded images so you may verify what I've stated if you'd like.

              • 4. Re: open container data script button
                jessicar

                One more image to show that it's a file Reference

                • 5. Re: open container data script button
                  jessicar

                  Ummm I feel silly but I found my error, don't waste your time troubleshooting this for me.

                  ...It's probably just me but just incase anyone else has the same problem:

                  That Display option in the Insert File dialog is overriding the selection I make in the Inspector.