Recently I worked on a project where the goal was to create an opener file that would run a script to determine which file to log into based on the user’s credentials. The launcher file would then open that correct file and close itself. I determined the best way to achieve this goal was to use FileMaker Pro Protocol.
The protocol format is intended to open shared or local files but it also allows you to run scripts, pass parameters and set local variables. The major benefit of using it this way is to avoid having to create external file references to the files where I want to run the scripts. This way I load the URL with the parameters I need and then use the Open URL script step to run it.
One of the difficulties about using the protocol is the strictly defined format. I made a mistake in my URL and left out a “?” and there is no way to debug it. I had to stare at it for a while to see where I had missed a character. I found a module on Modular FileMaker which is basically a custom function that takes the different parameters (user name, password, host, file, script, parameters, variables) and then generates the formatted URL. I still highly recommend using FMP Protocol where appropriate. I’ve summed up some pros and cons below.
- No need to add extra file references
- FMP URL scripts run with debugger
- Quick and easy to implement
- Strict formatting of URL can be difficult to debug
- On Windows using IE as the default browser limit URL to 2,083 characters (on the Mac using Safari it is 80,000)
- Local variables set using the URL can appear to pop up in a script instead of being explicity initialized. To work around this you can either add comments at the top of the script or run additional set variable script steps to re-initialize them.