9 Replies Latest reply on Oct 21, 2012 12:52 PM by sporobolus

    Applescript for opening remote file in FMP 12

    zadjfmp

      I had a nice applescript that opened a remote file on a FMP 11 server. Below is the script that worked with FMP 11. How do I get it to work with FMP 12. It will open Filemaker Pro 12, but not open the remote file.

       

      launch application "FileMaker Pro"

      tell application "FileMaker Pro"

      activate

      getURL "fmp7://username:password@111.222.333.44/FileName.fp7"

      end tell

      tell application "FileMaker Pro"

      do script "Reports"

      end tell

        • 1. Re: Applescript for opening remote file in FMP 12
          steve_ssh

          Hello Zadjfmp,

           

          The AppleScript that you list still reflects usage of the FMP7 protocol (used prior to version 12), as well as the .fp7 file format extension (used prior to version 12).

           

          This suggests that possibly:

           

              - You are trying to use FMP12 to open a file hosted by FMP11 (which, AFAIK, does not work)

           

              - You haven't updated your AppleScript to use the FMP protocol that is now used in version 12

           

          Does this make sense?

           

          Very best,

           

          -steve

           

           

           

          Reference to FMP protocol:

           

            http://www.filemaker.com/12help/html/sharing_data.16.7.html

          1 of 1 people found this helpful
          • 2. Re: Applescript for opening remote file in FMP 12
            zadjfmp

            thanks steve, I will try it and get back to you.

            • 3. Re: Applescript for opening remote file in FMP 12
              PeterGort

              launch application "FileMaker Pro Advanced"

              tell application "FileMaker Pro Advanced"

                activate

                        getURL "fmp://username:password@111.222.333.44/FileName"

                        --I generally insert a small delay after opening a file to give the system time to catch up on any threads

                delay 5

                        tell database "FileName"

                                  do script "Reports"

                        end tell

              end tell

              1 of 1 people found this helpful
              • 4. Re: Applescript for opening remote file in FMP 12
                zadjfmp

                I can get everything to work as long as FMP is open. How do I bypass the Open New or Existing File dialog if FMP is not open.

                • 5. Re: Applescript for opening remote file in FMP 12
                  steve_ssh

                  Hello Zadjfmp,

                   

                  I don't have expertise in this topic, so I will be curious to see what the more experienced folks will post in reply to your last message.

                   

                  With that said, I notice the following:

                   

                  The FMP protocol is recognized on my OSX machine as being associated with FileMaker version 12.  I believe this is a result of the standard install of FMP 12.

                   

                  This being the case, the following snippet of AppleScript launches FileMaker Pro Advanced 12 on my machine:

                   

                     do shell script "open 'fmp://username:password@111.222.333.44/FileName'"

                   

                  [ Important Note: Single quotes surround the URL within the double-quoted string ]

                   

                  I think it's a good guess that, were there such a file being hosted at the sample URL, FMPA would try to open it, but I can't make that as a certain claim since I'm not running anything hosted from a server to test against.

                  (Sorry I can't confirm this part for you.)

                   

                   

                  Regarding FMP's Initial File Opening Dialog:

                   

                  When launching FMPA with the above snippet of AppleScript, the standard FM Open File dialog does not appear on my machine.

                   

                  I suspect that there is a more direct AppleScript command that accomplishes the same thing without having to invoke a shell script, but I don't know what that would be -- I'll bet someone else can let us know.

                  Perhaps there's even a preference to get rid of the FMP File Open dialog that someone can enlighten us about... ??

                   

                  In the meantime, you've got an option that you can fiddle with to see if it does what you need,

                   

                  i.e. something that amounts to:

                   

                  do shell script "open 'fmp://username:password@111.222.333.44/FileName?script=MyScriptName'"

                   

                   

                  Note:

                   

                  I believe that you will want to URL encode both the value for FileName and MyScriptName.

                   

                  Example:

                   

                  If your File is named:  "My Great File"

                   

                  And your script is named:  "My Amazing Script"

                   

                  You would change each space char in the above names to: %20

                   

                  Resulting in a URL such as:

                   

                    fmp://username:password@111.222.333.44/My%20Great%20File?script=My%20Amazing%20Script

                   

                   

                  Sincerely HTH,

                   

                  -steve

                  • 6. Re: Applescript for opening remote file in FMP 12
                    sporobolus

                    on 2012-10-19 7:30 zadjfmp wrote

                    I can get everything to work as long as FMP is open. How do I bypass the Open New or Existing File dialog if FMP is not open.

                     

                    this is because of the "launch" command; it's redundant anyway; "activate"

                    implies launching the app, and also bypasses the quickstart screen

                     

                    tell application id "com.filemaker.client.advanced12"
                       -- or "com.filemaker.client.pro12"
                       activate
                       open file "HD:Users:usernname:Documents:xyz.fmp12"
                       tell database "xyz" to do script "Reports"
                    end tell
                    

                     

                    (i haven't seen a need for a delay, but it may be needed)

                    • 7. Re: Applescript for opening remote file in FMP 12
                      PeterGort

                      Hi Steve,  "delay" is needed if the file has a startup script, otherwise it isn't.  I agree the Launch command is redundant. Also, your example targets a local file, and zadjfmp was asking about a remote file, hence the "GetURL" syntax, not the "open file". I think you'll find, local or hosted, that the ".fmp12" extension is also redundant.

                      • 8. Re: Applescript for opening remote file in FMP 12
                        Malcolm

                        You can pass the user authentication in with the open command

                         

                        tell application id "com.filemaker.client.advanced12"

                           -- or "com.filemaker.client.pro12"

                           activate

                           open file "HD:Users:usernname:Documents:xyz.fmp12" for accounts "USER" with passwords "WPD"

                           tell database "xyz" to do script "Reports"

                        end tell

                         

                        Malcolm

                        • 9. Re: Applescript for opening remote file in FMP 12
                          sporobolus

                          on 2012-10-19 15:48 PeterGort wrote

                          Hi Steve,  "delay" is needed if the file has a startup script, otherwise it isn't.  I agree the Launch command is redundant. Also, your example targets a local file, and  https://fmdev.filemaker.com/people/zadjfmp zadjfmp was asking about a remote file, hence the "GetURL" syntax, not the "open file". I think you'll find, local or hosted, that the ".fmp12" extension is also redundant.

                           

                          i was mainly trying to help the OP around the initial dialog, and i try to post

                          examples i've actually tested, hence the non-server code; your comments about

                          the delay make sense, though it is a trouble area, as it can be hard to know

                          how long to wait; a semaphore has helped me in non-"on open" scripts; as for

                          getURL or "get remote URL" — i can't test either at the moment, do you know if

                          either accepts the handy ?script= arguments that steve_ssh pointed out?

                           

                          but regarding the filename extension, yes FileMaker adds some special sauce

                          even though the "file" keyword comes from AppleScript, not from FileMaker; you

                          cannot get away with omitting extensions like that when scripting any other app

                          i know, so i'd rather keep the extension than remember one more FileMaker quirk