Method

# GetOrdinalObjectDescriptor

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Returns an `AppleEventObjectSpecifier</api/macos/appleeventobjectspecifier>` that is within another `AppleEventObjectSpecifier</api/macos/appleeventobjectspecifier>`. The `AppleEventObjectSpecifier</api/macos/appleeventobjectspecifier>` is found by class and an ordinal key.

## Usage

``` xojo
result = GetOrdinalObjectDescriptor(DesiredClass, ObjectSpecifier, OrdinalKey)
```

| Part            | Type                                                              | Description                                                                            |
|-----------------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------|
| result          | `AppleEventObjectSpecifier</api/macos/appleeventobjectspecifier>` | The object that was found.                                                             |
| DesiredClass    | `String</api/data_types/string>`                                  | Indicates the class of `AppleEvent</api/macos/appleevent>` object you are looking for. |
| ObjectSpecifier | `AppleEventObjectSpecifier</api/macos/appleeventobjectspecifier>` | The source object. Pass `Nil</api/language/nil>` to search at the application level.   |
| OrdinalKey      | `String</api/data_types/string>`                                  | The scope to use when searching.                                                       |

## Notes

The ordinal keys are:

| Key  | Description |
|------|-------------|
| firs | First       |
| last | Last        |
| midd | Middle      |
| any  | Any         |
| all  | All         |

Ordinal keys are four characters so the "any" and "all" keys have a space following them.

## Sample code

This code asks the Finder for a count of the currently running processes:

``` xojo
Var a As AppleEvent
Var i, count As Integer
a = New AppleEvent("core", "cnte", "com.apple.finder")
a.MacTypeParam("kocl") = "prcs"
a.ObjectSpecifierParam("----") = GetOrdinalObjectDescriptor("prcs", Nil, "all ")
If a.Send Then
  count = a.ReplyString.ToDouble
End If
```

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | macOS   |

<div class="seealso">

`AppleEvent</api/macos/appleevent>` class; `GetIndexedObjectDescriptor</api/macos/getindexedobjectdescriptor>`, `GetNamedObjectDescriptor</api/macos/getnamedobjectdescriptor>`, `GetPropertyObjectDescriptor</api/macos/getpropertyobjectdescriptor>`, `GetRangeObjectDescriptor</api/macos/getrangeobjectdescriptor>`, `GetStringComparisonObjectDescriptor</api/macos/getstringcomparisonobjectdescriptor>`, `GetTestObjectDescriptor</api/macos/gettestobjectdescriptor>` functions.

</div>
