AppleScript Dictionary Terminology in Mac OS 9
In classic Mac OS 9, AppleScript enabled seamless automation of third-party applications by using application dictionaries to translate human-readable syntax into executable machine instructions. By embedding specialized terminology resources directly into software, developers exposed their internal commands, classes, and properties to the system. This architecture allowed the AppleScript compiler to dynamically understand external software capabilities, bridging the gap between natural-language scripting and low-level operating system events without requiring prior integration by Apple.
The Foundation: Apple Events and the Open Scripting Architecture
To understand application dictionaries, one must first look at Apple
Events. In Mac OS 9, interprocess communication relied heavily on Apple
Events—structured messages containing four-character codes (FourCCs)
that directed an application to perform specific tasks. For example, a
core command to open a document used the suite code 'aevt'
and the event ID 'odoc'.
While these four-character primitives were efficient for the operating system, they were impractical for everyday users to write. Apple addressed this through the Open Scripting Architecture (OSA), a framework that allowed scripting languages to map human-friendly verbs and nouns directly to these underlying codes.
The
aete Resource: The Application Dictionary
The core mechanism enabling this mapping in third-party software was
the aete (Apple Event Terminology Extension) resource.
Stored inside the resource fork of a Mac OS 9 application, the
aete resource acted as a standardized internal
dictionary.
When a developer made an application scriptable, they authored an
aete resource defining four primary components:
- Suites: Logical groupings of commands and objects (such as the Standard Suite, Text Suite, or proprietary vendor suites).
- Events (Verbs): The actions the application could
perform (e.g.,
duplicate,render,rotate), mapped to their respective four-character event codes. - Classes (Nouns): The objects the application
manipulated (e.g.,
document,character,layer), defined alongside their specific attributes. - Properties and Types: The characteristics of
objects (e.g.,
bounds,font,color) and the data types they accepted.
Dynamic Compilation and Translation
When a user wrote a script targeting a third-party application using
a tell application "ProgramName" block, the AppleScript
compiler queried that specific application for its aete
resource.
This dynamic query happened during script compilation:
- The compiler read the application’s
aeteresource to build an active vocabulary table. - The compiler validated the user's natural language syntax against the terms defined in the dictionary.
- Once validated, AppleScript compiled the human-readable text into a tokenized script containing the corresponding four-character event codes, class identifiers, and parameter keys.
Because translation occurred through the application's own
dictionary, AppleScript did not need built-in knowledge of third-party
programs. A desktop publishing program like QuarkXPress or an image
editor like Adobe Photoshop simply supplied its own domain-specific
terminology via its aete resource, which AppleScript
adopted instantly.
The Apple Event Object Model (AEOM)
The dictionary did not just supply standalone words; it defined relationships through the Apple Event Object Model (AEOM). The AEOM structured an application’s data hierarchically, allowing AppleScript to navigate complex application structures using container hierarchies.
Because the dictionary formally defined container relationships, a user could write commands targeting deeply nested objects, such as:
tell application "GraphicApp"
set color of shape 1 of layer "Background" to red
end tell
The dictionary informed the compiler that a layer
contained shapes, and that a shape possessed a
color property. When executed, Mac OS 9 packaged this
hierarchy into a resolved Apple Event specifier, which the target
application decoded and executed internally.
Script Editor and Introspection
The presence of the aete resource also made third-party
applications discoverable through introspection. Using the Mac OS 9
Script Editor, users could select "Open Dictionary" and choose any
installed application.
The Script Editor parsed the application's aete resource
and rendered it as an interactive, browsable reference manual. This
allowed scripters to see the exact verbs, parameters, required types,
and object models supported by any third-party program, establishing a
uniform development environment across the entire classic Mac OS
ecosystem.