3 Replies Latest reply on Jan 24, 2013 11:14 PM by DavidJondreau

    FM Go Deployment Strategy and Open URL Fail



      FM Go Deployment Strategy and Open URL Fail



           We have a GO solution that runs on the separation model.  The interface file is local to the device with the data streaming down from a hosted related file.


           Using a technique that we read about in Filemaker 12 Developer Reference (Bowers and his crew always produce amazingly useful stuff) we are attempting to have upgraded interface files pushed out to the iOS devices automatically as needed.  We modified the technique a little and maybe that's what's causing the problem...


           Essentially, in the hosted file we have a container field that holds the latest interface file.  There is also a field that contains the latest version number in the data file.  When an interface file on an iOS device launches the OnOpen script compares the local version number with latest version number in the data file.  If the iOS version is behind, it calls a script in the data file which is supposed to in turn call a subscript in the local interface file that will close the interface file and then export the field contents of the file field from the data file to the iOS device, writing over the outdated local file, and opening the newly exported updated file.


           For some reason we can't get the local interface file to close, so it won't allow itself to be written over.  I was hoping someone might have some suggestions.  I can't get the Open URL step to trigger the script that closes the file.  Maybe the URL is wrong.  Maybe there is a better way to do this.


           The OnOpen script on the iOS local file:


           Go To Layout ["zResources" (zResources)]

           If[zResources::VersionNumber < zResourcesHostFile::LatestiPhoneVersionNumber)

           Show Custom Dialog ["Update Version" ; "Your local version of the interface is out of date."]

           If(Get(LastMessageChoice) = 1

                 Perform Script ["Update iPhone Version" from file; HostFile

           End If


           The Update iPhone Version in the HostFile:


           Open URL [No dialog; "fmp://Interface.fmp12?Script=CloseFile"]



           Set Variable [$Filename; Value: "file:Interface.fmp12"]

           Export Field Contents [zResoucesHostFile::iPhoneFile ; $Filename"]

           Open URL [No Dialog; "fmp://~/Interface.fmp12"]


           The issue seems really to be getting the local interface file to close.  It won't allow an overwrite of an open file.  I'd welcome any thoughts on what might be amiss here.


           Thanks in advance.

        • 1. Re: FM Go Deployment Strategy and Open URL Fail

               Perform Script is a step you can use to perform a script in a different fileMaker file.

          • 2. Re: FM Go Deployment Strategy and Open URL Fail

                 Thanks for this suggestion.

                 It yeilds an error 100, File is Missing.

                 Normally when executing an external script the file you are using is open so you can select the script and the file path is automatically recorded.  I am unsure what to use as a file path in order for it be able to execute the script on the file local to the iOS device.  This is why I didn't use the perform script step and opted instead for the Open URL step.  I still can't get the Open URL step to function though.


            • 3. Re: FM Go Deployment Strategy and Open URL Fail

                   The served file can't close the local file, it has no and can't have, any knowledge of its filepath. You might be able to use the Close Window[] script step in the hosted file. But what I like to use is an Install OnTimer[] script step in the hosted file.

                   Instead of the Update iPhone Version script, have the local file call a new script, say Timer Delay. That script runs a an Install OnTimer script that calls your Update iPhone Version script, give it 3 seconds. Than your local OnOpen script continues and uses the Close File[] script step on itself. The local file closes, and the Update script runs.