Dictionary
Mac apps publish a dictionary of addressable objects and operations. Applescript leverages this dictionary to be able to communicate with those programs.
- These dictionaries can be viewed with the Script Editor program, and then File > Open Dictionary (
cmd+shift+o) - At its core, this scripting dictionary is a
.sdeffile that is stored in the app bundle.
Every scriptable app implements its own scripting features and exposes its own unique terminology through a scripting dictionary
Types of Terminology
Suite - A suite is a grouping of related commands and classes
- includes terminology supported by most scriptable apps, such as an
opencommand, aquitcommand, and anapplicationclass.
Command - A command is an instruction that can be sent to an app or object in order to initiate some action.
- ex.
delete,make,print
Class - A class is an object within an app, or an app itself
- ex. Mail has an application class, a message class, and a signature class, among others
Property - A property is an attribute of a class.
- ex. the message class in Mail has many properties, including
date received,read status, andsubject.
Concepts
Inheritance
different classes often implement the same properties.
- ex. in Finder, the file and folder classes both have creation date, modification date, and name properties
- Rather than defining these same properties multiple times throughout the scripting dictionary, Finder implements a generic
itemclass- any properties of the
itemclass also apply to thefileandfolderclasses
- any properties of the
Containment
Classes of a scriptable app reside within a certain containment hierarchy. The application is at the top level, with other classes nested beneath.
- ex. Finder contains
disks,folders,files, and other objects. - ex. Mail contains
accounts, which can containmailboxes, which can contain othermailboxesandmessages.