Sending files from Finder to FileMaker
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
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Pass File to FileMaker</string>
</dict>
<key>NSUserData</key>
<string>PassFile</string>
<key>NSMessage</key>
<string>ServiceInvoked</string>
<key>NSPortName</key>
<string>FileMaker Pro Advanced</string>
<key>NSRequiredContext</key>
<dict>
<key>NSTextContent</key>
<array>
<string>FilePath</string>
</array>
</dict>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
<string>public.plain-text</string>
<string>NSURLPboardType</string>
<string>public.url</string>
<string>public.file-url</string>
</array>
</dict>
</array>
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.