'The following example uses the ChildObjects method to retrieve a
set of child objects matching the description listed in the function
call and uses the method to display a message indicating how many
objects are found with the specified description: none, one (unique),
or several (not unique).
Public Function CheckObjectDesription(parent, descr)
Dim oDesc
' Create description object
Set oDesc = Description.Create()
arProps = Split(descr, ",")
For i = 0 To UBound(arProps)
arProp = Split(arProps(i), ":=")
If UBound(arProp) = 1 Then
PropName = Trim(arProp(0))
PropValue = arProp(1)
oDesc(PropName).Value = PropValue
End If
Next
' Get all child objects with the given description
Set children = parent.ChildObjects(oDesc)
If children.Count = 1 Then
CheckObjectDesription = "Object Unique"
ElseIf children.Count = 0 Then
CheckObjectDesription = "Object Not Found"
Else
CheckObjectDesription = "Object Not Unique"
End If
End Function
MsgBox CheckObjectDesription(Window("Flight Reservation"),_
"nativeclass:=Button", "text:=&Insert Order")
MsgBox CheckObjectDesription(Desktop, "nativeclass:=Notepad")