Are you encoding those spaces? You cannot have spaces in a url. %20 or + should be used for all spaces.
Also, what does this the Close File script contain? Is it simply Close File?
Hi John, On this particular script there is no spaces so I don't believe that is the issue. I may have been confusing in how I typed it above but each of those lines were used separately, not all in one calculation. That is just a few different ways I have tried it.
As for the close file script, Yep it is just close file, nothing else.
Thanks for responding.
Could you quote us the exact parameters you are passing, and how they are being recombined to produce the URL/path? The URLs you posted don't look properly formatted.
On a more basic issue, your thread title says you are trying to get FM Server to close a Local file running in FM Go. Do you mean a file on the local iOS device rather than on the server? I don't believe FM Server can access a file actually stored on the local iOS device at all. Server does not have access to the device as a file location.
Sure thing - here is the process, which is all taken from the attached PDF doc for the "one click" process that was designed for FM version 7. This is assuming I understood their doc correctly.
Step One: A button runs a script on the FM GO file called UPDATE. I pass a varialble "$filename" which sends the name of the file the iPad user is in. I also pass the current version of that file.
Set Variable [$filenameVar; Value;Get(FileName)]
Open URL [No dialog; "FMP://admin:myusername:password@myserverIP/Customer%20Manager.fmp12?script=Save File To Device&$Version=" & Overview::Global_iPad_FileVersion & "&$filename=$filenameVar" & ".fmp12"
Next, on the erver in the Customer Manager file, a script runs called Save File To Device, which looks like this:
If $Version >= Version
Set Variable $Path; Value: Get(DocumentsPath) & GoConnect:FileName // the name of the updated version file stored in a container field in the customer manager file.
//next is where the server is supposed to somehow apparently tell the device to close its local file. Doesnt make sense to me either but apparently I am either misunderstanding or it used to work in their verison 7 setup.
Open URL [No dialog; "fmp://RestorePoint_Dev_1.7.fmp12?script=Close File"] //here I am just hard coding the filename instead of using my variable to eliminate possible issues..
//Download the new file and override:
Export Field Contents [GoConnect::o_Container; "$Path"]
Right now, it works if I change the filename to something different than what is already loaded on the iPad. But the user will have to close their current file, and open the new file. The idea is that by closing the file, and downloading the new file with the same name, it will just automatically open the new file in "one click".
Edit - I went ahead and attached their demo files as well, if that helps. But GoConnect has to be on FM Server for it to work.
Seems this post talks about the same issue, sounds like he solved it by adding an extra file to stay open while the update processes. I guess I can try that method.
Hmm I think I am getting closer - but still cant quite get it to work.
What I really need is to be able to: close a local file, on filemaker GO, from another hosted file. If I can get that to work - I think I can make the rest of this work.
It seems like the above script (in the post above) should work, but once the script is finished it opens the file right back up, so apparently it never closed it.
Ah, if other file is referring the file to close, it will try to re open it.
Isn't there relation defined in hosted file ?
Then, make a 'closer file' as hosted which has no relation
run the script in it that close all (related) files.
Closing order of files is important to avoid re open, this is not only FMGo case.
Are you doing it with the OnTimer delay?
Are you certain that the file remains open, or are you just getting the error message? The reason I ask is I have a sync routine that does much the same thing. I almost always get an error 13 thrown, but the file ends up being closed, because I'm able to overwrite it.
Have you tried putting a short pause in your script right after the Open URL script step? It seems that this helps. I still get the error, but the file is released.
Happy to say I finally got this working thanks to all your replies. For anyone trying to implement the "One Click" updates method, my script is attached. Its still a work in progress and I have to replace a lot of the file names with variables, and clean up some stuff - but it works.
The last thing I had trouble with was getting the newly downloaded file to open.
For this, I simply used the Open URL to run a Open File script in the downloaded file. This script is run "on last window close" in the Update script. I have a some variables to make sure it only runs at the right time.
Anyway, as always thanks everyone for your help!