Since the first version of Mac OS X there exist the concept of services. So one application can offer a service and another app can use it. In most cases the user simply selects a picture, some text or a file and uses a service to pass that information to an application for processing. For example if you select an image file in Finder, you can use context menu service to make it your desktop picture.
Now coming to FileMaker. In order to provide a service with FileMaker, you have to go an edit the info.plist inside the Filemaker application. First make a copy, just to be save. Open the info.plist in a text editor (e.g. TextWrangler or BBEdit). Now copy & paste the xml below into the info.plist below the top
<string>Pass File to FileMaker</string>
<string>FileMaker Pro Advanced</string>
This declares a service. The menu item text "Pass File to FileMaker" can of course be modified by you. Also the "PassFile" text in the NSUserData entry can be customized. It can allow your script to know which service was executed if you have multiple services. The entries for NSMessage and NSPortName must be those values to make it working. Next two entries NSSendTypes and NSRequiredContext can be customized. Here they define that we want a file path as text or URL being passed.
After you defined, the service, you can logout your Mac and/or restart. On next login, the system will recognize services and add it to the list of services in keyboard preferences. And here you should enable your new FileMaker service:
Now in FileMaker in your solution you can use ServiceProvider.Install command from MBS Plugin to register a service provider. Please do that in a script run at startup. You specify the file name of the database where the script resides and also the name of the script to call when a service request is received:
Set Variable [$r; Value:MBS("ServiceProvider.Install"; Get(FileName); "ServiceCall")]
Now in the ServiceCall script we ask the plugin for the file path and import the file into a container field:
Set Field [ServiceProvider::Paths; MBS("ServiceProvider.Value"; "Paths")]
Set Variable [$Path; Value:MBS("Path.NativePathToFileMakerPath"; ServiceProvider::Paths)]
Insert File [Never compress; ServiceProvider::File; "$Path"]
In the solution this looks like this. First we select file in Finder and choose the menu command to pass to FileMaker:
and in database we see file is imported:
Finally you can send files from Finder directly to FileMaker via contextual menu!
If you have questions, please do not hesitate to contact us.