This appendix describes some commonly used Apple event constants. For more complete documentation, see Apple Event Manager Reference.
Event Class Constants
Event ID Constants for Apple Events Sent by the Mac OS
Event ID Constants for Standard AppleScript Commands
Descriptor Type Constants
Address Descriptor Type Constants
Attribute Keyword Constants
Parameter Keyword Constants
Event Source Constants
Send Mode Constants for the AESend Function
Table B-1 lists several event class constants. For related information, see “Event Class and Event ID.”
Event class | Value | Description |
---|---|---|
|
| An Apple event sent by the Mac OS that your application should support if appropriate (sometimes called “required” events) |
|
| A core Apple event; events with this type or with the |
|
| An event that the Finder accepts |
|
| Deprecated constant for Finder event |
|
| Remote procedure call event |
|
| Text suite event |
|
| Folder actions event |
|
| Internet suite event |
|
|
Table B-2 shows event IDs for various Apple events that may be sent to your application by the Mac OS. For more information, see “Handling Apple Events Sent by the Mac OS.” These events are sometimes referred to as the “required” events, and have the event class value 'aevt'
, defined by the constant kCoreEventClass
. For related information, see “Event Class and Event ID.”
Table B-3 shows event IDs for Apple events that represent various standard AppleScript commands. Each scriptable application should support as many of these commands as make sense for that particular application. These events are sometimes referred to as "standard" or "core" events, and have the event class value 'core'
, defined by the constant kAECoreSuite
. For related information, see “Event Class and Event ID.”
Event ID | Value | Description |
---|---|---|
|
| Duplicate the specified AppleScript object or objects. |
|
| Close the specified object or objects, usually consisting of windows or documents. |
|
| Return the number of objects of a particular class contained by the specified object or objects. |
|
| Create a new object. |
|
| Delete the specified object or objects. |
|
| Return a boolean value indicating whether the specified object or objects exist. |
|
| Return the specified data from an object or set of objects. |
|
| Move an object or set of objects. |
|
| Save an object or objects, often consisting of windows or documents. |
|
| Set the data of an object or objects. |
In a descriptor, the descriptorType
structure member stores a value that is a four-character code. Table B-4 lists constants for some of the main descriptor types, along with their four-character code values and a description of the kinds of data they identify. For a complete list of the basic descriptor types, see Apple Event Manager Reference.
Descriptor type | Value | Description of data |
---|---|---|
|
| 1-byte Boolean value |
|
| 32-bit integer |
|
| Unicode text (UTF-8 encoding) |
|
| Unicode text (UTF-16 encoding) |
|
| 16-bit integer |
|
| List of descriptors |
|
| List of keyword-specified descriptors |
|
| Apple event |
|
| Enumerated data |
|
| Four-character code |
|
| File-system reference |
|
|
The descriptor type in an address descriptor can be specified by one of the type constants shown in Table B-5 (or by any type you define for which you provide a coercion to one of these types):
Descriptor type | Value | Description |
---|---|---|
|
| Application signature |
|
| Deprecated; do not use in Mac OS X |
|
| Process serial number |
|
| Kernel process ID |
|
| Application bundle ID (Mac OS X version 10.3 and later) |
|
| Application URL, possibly for a remote application (Mac OS X version 10.1 and later) |
|
| Mach port. |
For information on how to create a target descriptor, see “Specifying a Target Address.”
Your application cannot examine the attributes and parameters of an assembled Apple event directly. Instead, it calls Apple Event Manager functions to request an attribute or parameter by keyword. Keywords are arbitrary values used to keep track of various descriptors.
See “Keyword Parameter Constants” in Apple Event Manager Reference for descriptions of keyword constants for additional Apple event parameters.
Table B-6 lists keyword constants for Apple event attributes:
Attribute keyword | Value | Description |
---|---|---|
|
| Address of target or client application |
|
| Event class of Apple event |
|
| Event ID of Apple event |
|
| Nature of the source application |
|
| Settings for whether to allow bringing a server application to the foreground, if necessary, to interact with the user |
|
| Address of original source of Apple event if the event has been forwarded |
|
| Return ID for reply Apple event |
|
| Length of time, in ticks, that the client will wait for a reply or a result from the server |
|
|
Table B-7 lists keyword constants for commonly used Apple event parameters:
Parameter keyword | Value | Description |
---|---|---|
|
| Direct parameter |
|
| Error number parameter (used only in reply events) |
|
| Error string parameter (used only in reply events) |
|
| Process serial number |
|
| Dispatch event to predispatch handler |
|
| AppleScript version |
See “Keyword Parameter Constants” in Apple Event Manager Reference for descriptions of keyword constants for additional Apple event parameters.
You use the constants in Table B-8 to check the value of the keyEventSourceAttr
attribute, which specifies the source of an Apple event. Listing 4-3 shows how to obtain that attribute from an Apple event.
When you send an Apple event with AESend
, you use one of the constants in Table B-9 in the sendMode
parameter to specify how to deal with replies.
© 2005, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)