1 Reply Latest reply on Nov 21, 2012 4:28 PM by robwoof

    How to see if a sharepoint is mounted






      I have a script that places a file into a folder on a OS X server (not the FM server).


      I want to make sure that the users will not be able to run this script if the


      sharepoint is not mounted.


      How would I construct a FM opening script to check if the sharepoint is mounted


      and place a marker in the above script allowing or disallowing it's execution?






      Thanks and Happy Thanksgiving,





        • 1. Re: How to see if a sharepoint is mounted

          The "Set Error Capture (On)" does not trap Export Field Contents and Insert File errors where the file or location is not available, so you need to be a bit sneaky. We can exploit the fact that anything involving files can have multiple paths/names specified, and FileMaker tries them in order until one works.


          Set up a global Container field on a layout somewhere in your database and put a small file of any type in it. Your open script would then be something like:


          Go to layout [<layout with global container field>]

          Set Variable [$tmp ; Get ( TemporaryPath ) ]

          Export Field Contents [ <globalContainerField> ; $tmp/<smallFileName> ]

          Export Field Contents [ <globalContainerField> ; <pathToShare>/<smallFileWithDifferentName>,$tmp/<smallFileName> ] **

          Insert File [ <globalContainerField> ; <pathToShare>/<smallFileWithDifferentName>,$tmp/<smallFileName> ]  **

          If [ <globalContainerField> = <DifferentFileName> ]

                 <share is mounted, all good>


                 <share is not mounted>

                 <run AppleScript that mounts the volume>

          End If


          ** Note that the two specified paths are on separate lines in the Specify File dialog.


          The key is in the Export Field Contents steps and the Insert File step. The first Export Field Contents places the file in a known location on the local drive. The second attempts to place the file (with a different name) in a location that may not be there, If that location is not there, it defaults to the local drive location. The Insert File then tries to insert the differently-named file into the field from the share location, and if that fails it inserts from the local location. The name of the file in the container field tells you which location it came from. You avoid having error messages troubling the user.