Occasionally, in development, I find that I need to provide some sort of user feedback regarding the completion of a script or to display information to the user and sometimes a custom dialog is not the best solution. And, me just being me, I want to do it in a very useful, efficient and also cool way.


OS X Yosemite notification generated by FileMaker Pro 13


Well, if your user is on a Mac running Yosemite, you’re in luck because FileMaker can run AppleScript natively which will allow you to control OS X apps.

[ Insert cool factor here… ] This will allow you to AppleScript OS X notifications from FileMaker.

If you’re not familiar with it, AppleScript is a scripting language created by Apple Inc. and built into Macintosh operating systems since OS 7. There are numerous resources to learn all about it from books to blogs. A simple google search returns many tutorials from beginner to advanced level AppleScripting.

That being said, you can combine some simple AppleScript with the Perform AppleScript() script step in FileMaker Pro to create a notification to the user. The AppleScript to create the notification requires a Title and a message but the subtitle is optional.

The AppleScript

Below is our base AppleScript to generate a notification in OS X Yosemite.

[pre ]display notification “Hello world!” with title “New Notification” subtitle “From FileMaker” sound name “default” delay 1[/pre]

In this example “Hello world!” is your notification’s message. “New Notification” is the title of your notification and “From FileMaker” is your subtitle. You also have the option to generate a sound for the notification. Default is usually the best idea here to ensure that every user gets a similar experience. I have specified “delay 1” to ensure that the script has time to execute and trigger the notification.

Modify the Applescript

Before putting this into the calculation window of the script step in your FIleMaker script, you will need to add quotes, carriage returns and commented quotes to the AppleScript so that your calculation evaluates properly for the AppleScript to execute.

First, the entire AppleScript needs to be encapsulated in double quotes. As you will notice, your message, title and subtitle are also in quotes. You must escape these quotes so that they are regarded as text and not evaluated as the end of the variable. So your script now looks like this…


On to FileMaker

Now you’re ready to write your script in FIleMaker. First you will create 3 variables for $title, $message and $subtitle.


Next, insert the “Perform AppleScript” script step, choose “Calculated AppleScript” and paste the modified AppleScript into the calculation window. You can save the script and do a test run with your static message to ensure that everything is jiving. You should see a notification like the one above provided you are on OS X Yosemite. (This may work for other versions of Mac OS, but they have not been tested or verified).

The next thing you’ll want to do is to alter the AppleScript to use your variables. This will make the script modular so that you can pass script parameters to the notification.


Test the script

And finally, you’ll need a way to trigger and set the parameters to the script. So create a button and set script parameters for your notification title, message and subtitle.

Wrap up

I can honestly think of a million times to use AppleScript OS X notifications from FileMaker in a solution to give the user a more “native app” feel on OS X (okay, maybe not a million, but a lot). I hope you’ve enjoyed this snippet and it has sparked your interest in AppleScript. Using the tools and technologies we have, we can extend the usefulness and useability of FileMaker solutions we build and give a more polished approach to simple tasks.

[call_two href=”https://scarpettagroup.com/filemaker-contact-us/” label_button=” Contact us!” class=”call-to-action-two” colorstart=”#c4c4c4″ colorend=”#FFFFFF” colortext=”#000000″ icon_size=”20″ color=”” align=”vertical” width=”small” icon=”icon-check” ]If you have any questions or would like to have assistance implementing these features in your solutions, please contact us at scarpettagroup.com[/call_two]