Scripting the “Notes” Application

The Notes application is designed for whatever’s on your mind, wherever you happen to be. Think it up. Jot it down. Make it even more noteworthy with photos, images, and attachments. You can add, delete, and flip through your notes or do a quick search. Use the Share button to send your notes with Mail or Messages. Pin important notes to your desktop so they’re easy to get to. And take them with you everywhere. Notes works with iCloud, so when you create or edit a note on your Mac, it automatically updates on your iPhone, iPad, and iPod touch. And vice versa.

And the Notes application includes AppleScript support, wih a scripting dictionary enabling the various application elements to be queried and controlled using AppleScript scripts.

Viewing the “Notes” Dictionary

library-palette-01

To view the scripting dictionary for the Notes application, launch the AppleScript Editor application found in the Utilities folder. In the AppleScript Editor application, select the “Library” menu item from the “Window” menu to summon the Library palette. This palette contains easy-to-access links to popular scriptable applications in the OS. If the Notes application is not already on this list, you can add it to the library list by clicking the plus button at the top left of the palette.

In the forthcoming choosing sheet, navigate to the Applications folder and select the Notes application:

choose-application

Click the “Open” button and the Notes application will be added to the Library list. Double-click the Notes application in the library palette list to open its dictionary viewer window.

notes-dictionary

Exploring the “Notes” Dictionary

The following pages will examine in detail how to use AppleScript to automate the creation and management of notes. Use the links in the red navigation box on the right, to view the pages for each topic.

Activating the Script Menu

If you want to save and reuse the example scripts from this documentation, open the AppleScript Editor application (found in the Utilities folder), and display its preference window by selecting “Preferences…” from the Application menu. In the General preference tab, select the checkbox titled: Show Script menu in menu bar

asprefswindow

The Script Menu icon will now be visible at the right of the main menu bar. Create the designated folder for Notes scripts, by selecting “Open Notes Scripts Folder” from the “Open Scripts Folder” menu:

scriptmenu

A new folder for the Notes script files, titled “Notes”, will be created in the Home > Library > Scripts > Applications folder. Scripts saved into this folder will appear in the Script Menu when Notes is the frontmost application.

TOP | CONTINUE