Carbon


Constants for Object Specifier Records, Positions, and Logical and Comparison Operations

Header: AEObjects.h

Specify the types of the four keyword-specified descriptors that make up the data in an object specifier record, as well as constants for position, logical operations, and comparison operations..

enum {
    kAEAND = 'AND ',
    kAEOR = 'OR  ',
    kAENOT = 'NOT ',
    kAEFirst = 'firs',
    kAELast = 'last',
    kAEMiddle = 'midd',
    kAEAny = 'any ',
    kAEAll = 'all ',
    kAENext = 'next',
    kAEPrevious = 'prev',
    keyAECompOperator = 'relo',
    keyAELogicalTerms = 'term',
    keyAELogicalOperator = 'logc',
    keyAEObject1 = 'obj1',
    keyAEObject2 = 'obj2',
    keyAEDesiredClass = 'want',
    keyAEContainer = 'from',
    keyAEKeyForm = 'form',
    keyAEKeyData = 'seld'
};

Constant descriptions

kAEAND

Specifies a logical AND operation.

kAEOR

Specifies a logical OR operation.

kAENOT

Specifies a logical NOT operation.

kAEFirst

The first element in the specified container.

kAELast

Specifies the last element in the container.

kAEMiddle

Specifies the middle element in the container. If an object specifier record specifies kAEMiddle and the number of elements in the container is even, the Apple Event Manager rounds down. For example, in a range of four words the second word is the “middle” word.

kAEAny

Specifies a single element chosen at random from the container.

kAEAll

Specifies all the elements in the container.

kAENext

Specifies the Apple event object after the container.

kAEPrevious

Specifies the Apple event object before the container.

keyAECompOperator

Specifies a descriptor of typeType, whose data consists of one of the constant values described in “Comparison Operator Constants”.

keyAELogicalTerms

Specifies a descriptor of type typeAEList containing one or more comparison or logical descriptor records.

keyAELogicalOperator

Specifies a descriptor of type typeEnumerated whose data is one of the logical operators (such as kAEAND) defined in “Constants for Object Specifier Records, Positions, and Logical and Comparison Operations”.

keyAEObject1

Identifies a descriptor record for the element that is currently being compared to the object or data specified by the descriptor record for the keyword keyAEObject2. Either object can be described by a descriptor record of type typeObjectSpecifier or typeObjectBeingExamined.

A descriptor record of typeObjectBeingExamined acts as a placeholder for each of the successive elements in a container when the Apple Event Manager tests those elements one at a time.

keyAEObject2

Identifies a descriptor record for the element that is currently being compared to the object or data specified by the descriptor record for the keyword keyAEObject1.

The keyword keyAEObject2 can also be used with a descriptor record of any other descriptor type whose data is to be compared to each element in a container.

keyAEDesiredClass

A four-character code that identifies the object class of the specified object or objects.

Constants for object class IDs are described in “Object Class ID Constants”.

keyAEContainer

Specifies the container for the requested object or objects. The data is an object specifier record (or in some cases a null descriptor).

keyAEKeyForm

A four-character code that identifies the key form for the specified object or objects.

The constants for specifying the key form are described in “Key Form and Descriptor Type Object Specifier Constants”.

keyAEKeyData

Data or nested descriptor records that specify a property, name, position, range, or test, depending on the key form.

The descriptor types used in object specifier records are described in “Key Form and Descriptor Type Object Specifier Constants”.

When you call the CreateLogicalDescriptor function to create a logical descriptor record, you pass one of the logical operators kAEAND, kAEOR, or kAENOT in the theLogicOperator parameter. The CreateLogicalDescriptor function creates a logical descriptor record that specifies a logical operation to perform on one or more operands.

The constants kAEFirst , kAELast , kAEMiddle , kAEAny, and kAEAll provide the key data for a keyword-specified descriptor record of key form formAbsolutePosition and descriptor type typeAbsoluteOrdinal.

The constants kAENext, and kAEPrevious provide the key data for a keyword-specified descriptor record of key form formRelativePosition.

Key form constants and descriptor type constants for object specifiers are defined in “Key Form and Descriptor Type Object Specifier Constants”.

The constants keyAELogicalTerms and keyAELogicalOperator define the keyword descriptors for a logical descriptor record. A logical descriptor record is a coerced AE record of type typeLogicalDescriptor that specifies a logical expression—that is, an expression that the Apple Event Manager evaluates to either TRUE or FALSE.You can create a logical descriptor record with the CreateLogicalDescriptor function.

The data for a logical descriptor record consists of two keyword-specified descriptor records: the first with descriptor type keyAELogicalOperator, descriptor type typeEnumerated, and one of the logical operators defined in “Constants for Object Specifier Records, Positions, and Logical and Comparison Operations” for its data; and the second with descriptor type keyAELogicalTerms, descriptor type typeEnumerated, and one or more comparison or logical descriptor records for its data. Comparison constants are described in “Comparison Operator Constants”.

The logical expression is constructed from a logical operator (one of the Boolean operators AND, OR, or NOT) and a list of logical terms to which the operator is applied (where NOT can only be used where the list of terms is a single-item list). Each logical term in the list can be either another logical descriptor record or a comparison descriptor record (described in “Constants for Object Specifier Records, Positions, and Logical and Comparison Operations”).

The Apple Event Manager short-circuits its evaluation of a logical expression as soon as one part of the expression fails a test. For example, if while testing a logical expression such as A AND B AND C the Apple Event Manager discovers that A AND B is not true, it will evaluate the expression to FALSE without testing C.

The constants keyAECompOperator, keyAEObject1, and keyAEObject2 define the keyword descriptors for a comparison descriptor record. A comparison descriptor record is a coerced AE record of type typeCompDescriptor that specifies an Apple event object and either another Apple event object or data for the Apple Event Manager to compare to the first object. You can create a logical descriptor record with the CreateCompDescriptor function.

The Apple Event Manager can also use the information in a comparison descriptor record to compare elements in a container, one at a time, either to an Apple event object or to data. The data for a comparison descriptor record consists of three keyword-specified descriptor records:

  • A descriptor with keyword keyAEObject2 and either

  • descriptor type typeObjectSpecifier and object specifier data to compare, or
  • descriptor type typeObjectBeingExamined and a data storage pointer of NULL, or
  • any other descriptor type and the data to be compared for that descriptor type.
  • You don’t have to support all the available comparison operators for all Apple event objects; for example, the “begins with” operator probably doesn’t make sense for objects of type cRectangle. It is up to you to decide which comparison operators are appropriate for your application to support, and how to interpret them. If necessary, you can define your own custom comparison operators. If you think you need to do this, check the Apple Events and Scripting header files or the Mac OS Registry (a database collection of Apple Event and Scripting information distributed with AppleScript SDKs) to see if existing definitions of comparison operators can be adapted to the needs of your application.

    An object specifier record is a coerced AE record of descriptor type typeObjectSpecifier whose data contains consists of four keyword-specified descriptors. The constants keyAEDesiredClass, keyAEContainer, keyAEKeyForm , and keyAEKeyData specify the keywords for the four descriptor types that together identify the specified object or objects.


    © 2000 Apple Computer, Inc. (Last Updated 6/30/2000)