Using AppleScript to send FileMaker data to Apple Notes App


Recently, a friend asked me about automating the export of data from FileMaker to Evernote. A web search found that someone had already figured this out. I thought this might be useful to send data to Notes, the app that I use.

This post was inspired by a blog entry at Veritrope.com about sending FileMaker data to Evernote. The basis of the Notes exporting Applescripts are from Mac OS X Automation.

This script in the demo file takes some data from FileMaker fields and creates a new note in the Macintosh Notes App. Obviously, because it is using AppleScript, talking to Apple Notes app, it currently only works on a Macintosh.

Download Demo

Send to Apple Notes App

send-to-apple-notes-app

Click the blue button on a record and it is sent to the Notes app.

FileMaker data transferred to Notes

filemaker-data-transferred-to-notes

A new note appears in the Notes app.

the-settings-tab

The Settings tab

This field is used to store the Account you wish to use in Notes. You should add this field to your database and adjust the script called “Get the Notes Account”. I have set this up as a Global field, but in a multi-user, hosted solution, it could be a standard text field tied to a User table. If this field is empty, it is requested in the first run of the main ‘Send to Notes App’ script.

 

The Important Scripts and Variables to Import and Adapt

the-important-scripts-and-variables-to-import-and-adapt

To import this into your solution, edit the three variables here: $Account, $Header and $Body. You can concatenate information into any of these variables. Just watch out for quotation marks and smart quotes. I am substituting them out for single quotes.

To add this to your solution, add a field to store the Apple Notes Account. Copy the two scripts and edit the required fields.

A fancier version of this could be to create notes in a loop. Another area to explore might be to include PDFs or images in the database. Another thing to explore is going the other way, writing an AppleScript that sends a folder of Notes to FileMaker. That is harder.

I hope this is useful.

 

Security Setting

SecuritySettings

One more thing. In newer versions of FileMaker Pro, you have to explicitly allow the running of Applescripts. This is used in the callback script that sets the Notes Account. Make sure this is turned on in your solution when you import the scripts to your new solution.

The Calculated Applescript

the-calculated-applescript

” set noteHTMLText to \”” & $Body & “\” as Unicode text¶

set the noteTitle to \””& $Header&”\”¶¶

tell application \”Notes\”¶

activate¶

set thisAccountName to my getNameOfTargetAccount(\”Choose an account:\”)¶

tell account thisAccountName¶

make new note at folder \”Notes\” with properties {name:noteTitle, body:noteHTMLText}¶

end tell¶

end tell¶¶

on getNameOfTargetAccount(thisPrompt)¶

tell application \”Notes\”¶

if the (count of accounts) is greater than 1 then¶

set theseAccountNames to the name of every account¶

set thisAccountName to (choose from list theseAccountNames with prompt thisPrompt)¶

if thisAccountName is false then error number -128¶

set thisAccountName to thisAccountName as string¶

else¶

set thisAccountName to the name of account 1¶

end if¶

return thisAccountName¶

end tell¶

end getNameOfTargetAccount”

 

3 Responses to “Using AppleScript to send FileMaker data to Apple Notes App”

  1. Thanks for sharing ! You Demo works very nicely !

    Do you know how to not loose line breaks that are on body ?

    Actually they are not passed to the new note…

  2. Just found it : sorry. Add the substitution [ “¶” ; “”]

  3. my last comment was unexpectedly altered : i wrote br between balise and this was vanished