2. API overview
Classes
The main AEM classes are as follows:
- Application
- Represents a scriptable application, and provides an
#event
method for constructing Apple events. - Event
- Represents a ready-to-send Apple event, and provides a
#send
method for sending it. Returned by theApplication
class's#event
method. - EventError
- Exception raised to indicate an application or Apple Event Manager error.
- Codecs
- Provides
#pack
and#unpack
methods for converting Ruby values to AE types, and vice-versa. Clients usually don't need to access this class directly. - AEType, AEEnum
- Represent Apple event type and enumerator values.
In addition, there are a number of classes used to represent application references, although the user does not instantiate these directly.
Methods
The AEM module exports three top-level methods for use in constructing application references:
- app
- Returns the base object used to construct absolute references.
- con
- Returns the base object used to construct relative reference to container object (used in by-range specifiers).
- its
- Returns the base object used to construct relative reference to object being tested (used in by-filter specifiers).
References are constructed from these base objects using chained method calls.
Modules
The following support modules are also provided:
- FindApp
- Provides functions for locating applications by name, bundle id or creator code.
- AE
- Low-level extension that defines an
AEDesc
class representing Carbon Apple event descriptors (AEDescs). Also provides a number of support methods used by AEM, appscript and related packages. - KAE
- Exports constants defined by Apple Event Manager and Open Scripting APIs.