2 Replies Latest reply on Apr 22, 2017 10:38 AM by acuriousboonz

    Cross-Platform Open URL to open synced folder - FileMaker 15 Pro




      As a scientist, I generate a considerable amount of experimental data from instruments. These experiments generate several folders and a lot of small files, all of which are stored in a folder named after the date on which the data was obtained.


      Currently, these folders are stored on Google Drive.


      I'm trying to create a script in FileMaker 15 Pro using the Open URL command to open these folders in their corresponding records. I have a Mac laptop for work and a Windows PC at home. Both of the computers can access the data but the file path on each operating system is slightly different. For example.


      Mac: file:///Users/Name1/Google Drive/Institution/Lab Name/Instrument Type/Instrument Name/04-21-2017


      where "04-21-2017" is the name of the folder that contains the experimental data.


      Whereas on PC the path is: file:///C:/Users/Name2/Google Drive/Institution/Lab Name/Instrument Type/Instrument Name/04-21-2017


      Currently, starting on my Mac, I type the file path of folder "04-21-2017" into Field1, use a button to activate the script


           Insert Text [Select; Table::Field2; "file:///C:/Users/Name1/"]

           Set Selection [Table::Field1; Start Position: 31; End Position: 98]

           Copy [Table::Field1]

           Paste [No style; Table::Field2]


      to automate converting the Mac file path from Field1 into the corresponding Windows file path and paste it into Field2.


      And then another button to activate a script to try and open both the mac file path and the windows file path simultaneously. Only the file path that corresponds to the operating system I'm using actually opens the folder, as expected.


           Open URL [With dialog:Off; Table::Field1]

           Open URL [With dialog:Off; Table::Field2]


      This works but I'm still learning how to use FileMaker Pro 15 - is there a better way to do this?


      Also, I'd really like to be able to drag and drop the folder from Google Drive onto Field1 and have the program automatically write the corresponding file path to that field. Is this possible?


      Any help would be greatly appreciated, thanks!

        • 1. Re: Cross-Platform Open URL to open synced folder - FileMaker 15 Pro
          Jason Wood

          First thing you need to do is stop using script steps like "Insert Text", "Set Selection", "Copy", and "Paste" unless there is a good reason (almost never). You are basically asking the computer to pretend it is a user sitting in front of a mouse and keyboard. It's very fragile and "Copy" is interfering with the user's clipboard.


          Look into the "Set Field" script step, which does not require the field to be on the layout.


          But in this case you don't need fields at all, except for the field that contains the directory.


          Open URL [ No Dialog ;

          If ( Get ( SystemPlatform ) = 1 ; "file:///Users/Name1/Google Drive/Institution/Lab Name/Instrument Type/Instrument Name/" & Table::directoryField ; "file:///C:/Users/Name2/Google Drive/Institution/Lab Name/Instrument Type/Instrument Name/" & Table::directoryField )


          2 of 2 people found this helpful
          • 2. Re: Cross-Platform Open URL to open synced folder - FileMaker 15 Pro

            I'll look into "Set Field".


            Thanks for the help with the Open URL script! I didn't realize you could put commands in the URL field. And not having to type the complete file path string every time is perfect.


            Does the last portion of that script imply 'use this URL for cases when "If (Get (SystemPlatform) =/= 1"'? I would have thought you needed to use an If{ }, Else{ } type script.