Difference between revisions of "GetOrdinalObjectDescriptor"

From Xojo Documentation

m (Examples)
 
Line 83: Line 83:
 
This code asks the Finder for a count of the currently running processes:
 
This code asks the Finder for a count of the currently running processes:
 
<rbcode>
 
<rbcode>
Dim a As AppleEvent
+
Var a As AppleEvent
Dim i, count As Integer
+
Var i, count As Integer
 
a = New AppleEvent("core", "cnte", "com.apple.finder")
 
a = New AppleEvent("core", "cnte", "com.apple.finder")
 
a.MacTypeParam("kocl") = "prcs"
 
a.MacTypeParam("kocl") = "prcs"
 
a.ObjectSpecifierParam("----") = '''GetOrdinalObjectDescriptor'''("prcs", Nil, "all ")
 
a.ObjectSpecifierParam("----") = '''GetOrdinalObjectDescriptor'''("prcs", Nil, "all ")
 
If a.Send Then
 
If a.Send Then
   count = Val(a.ReplyString)
+
   count = a.ReplyString.ToDouble
 
End If
 
End If
 
</rbcode>
 
</rbcode>

Latest revision as of 21:57, 18 July 2019

Method


Returns an AppleEventObjectSpecifier that is within another AppleEventObjectSpecifier. The AppleEventObjectSpecifier is found by class and an ordinal key.

Syntax

result=GetOrdinalObjectDescriptor(DesiredClass, Object, OrdinalKey)

Part Type Description
result AppleEventObjectSpecifier The object that was found.
DesiredClass String Indicates the class of AppleEvent object you are looking for.
Object AppleEventObjectSpecifier The source object. Pass Nil to search at the application level.
OrdinalKey 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:

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

See Also

AppleEvent class; GetIndexedObjectDescriptor, GetNamedObjectDescriptor, GetPropertyObjectDescriptor, GetRangeObjectDescriptor, GetStringComparisonObjectDescriptor, GetTestObjectDescriptor functions.