Scripting Notes: The Application Class
The top-level scripting object in any application is always the application itself. The application class can contain properties, specialized verbs (commands), and other scriptable elements (classes) that are contained by the application.
In the Notes scripting dictionary, the application class is found in two scripting suites: the Standard Suite, found in most scriptable applications, and the Notes Suite, specific to the Notes applicaion.
The application class in the Standard Suite contains a few standard application properties, such as name and version; a list of the standard application elements it contains, windows; and a list of standard verbs that can be directed at the application.
application n [see also Notes Suite] : The application’s top-level scripting object.
elements
contains: windows.
properties
frontmost (boolean, r/o) : Is this the active application?
name (text, r/o) : The name of the application.
version (text, r/o) : The version number of the application.
responds to
count, delete, exists, move, quit, print (window object only).
The application class in the Notes Suite contains only a list of the elements that belong to the application class itself: accounts, folders, notes, and attachments.
application n [see also Standard Suite] : the Notes application
elements
contains: accounts, folders, notes, attachments.
It is important to point out, that by belonging to the top-level application class, these elements (notes, folders, attachments) become available for high-level searches and actions, such as finding, moving, or deleting all notes/folders, or only the notes/folders matching a specific set of attributes.
Example Scripts
The following script examples demonstrate how to access and manipulate the application class elements. To open an example script in the AppleScript Editor application on your computer, click the script icon at the top left of an example script. (Requires OS X Mountain Lion)
This example demonstrates the use of the exists and move verbs with the notes and folder application elements.
This example demonstrates the use of the delete verb with the notes application element.
This example demonstrates the use of the delete verb with the folder application element.
IMPORTANT: Never delete the “Notes” folder from an account. Doing so can put the Notes application in a non-functioning state.
This example demonstrates how to set the value of a property of the window application element.
How to resize the notes window by setting the value of the bounds property of the window application element.