py-appscript

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 the Application class's event method.
EventError
Represents an error raised by the target application or the Apple Event Manager.
Codecs
Provides pack and unpack methods for converting Python 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.

Attributes

AEM exports three top-level attributes for use in constructing application references:

app
Base object used to construct absolute references.
con
Base object used to construct relative reference to container object (used in range specifiers).
its
Base object used to construct relative reference to object being tested (used in filter specifiers).

References are constructed from these base objects using chained property/method calls.

Modules

AEM also exports the following support modules:

findapp
Provides functions for locating applications by name or bundle id.
ae
Low-level extension that defines an AEDesc type representing Carbon Apple event descriptors (AEDescs). Also provides a number of support functions used by AEM, appscript and related packages.
kae
Exports constants defined by Apple Event Manager and Open Scripting APIs.