Configure Assistive Properties for a Test Object
Source code
'This example opens UFT and configures the Object Identification settings for the WinList test object class.

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtIdent 'As QuickTest.ObjectIdentification ' Declare the ObjectIdentification object variable
Dim qtWinListIdent 'As QuickTest.TestObjectClassIdentification ' Declare the variable for the WinList object class identification
Dim intPosition ' Declare a variable for storing positions

' Open UFT and set variables
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start UFT
qtApp.Visible = True ' Make the UFT application visible

Set qtIdent = qtApp.Options.ObjectIdentification ' Return the ObjectIdentification object
Set qtWinListIdent = qtIdent.Item("WinList") ' Return the collection of object identification properties for the WinList object class

qtIdent.ResetAll ' Reset the Object Identification description for the WinList object to the default property set
qtWinListIdent.OrdinalIdentifier = "Index" ' Set Index as the ordinal identifier

' Configure the Mandatory Properties
intPosition = qtWinListIdent.MandatoryProperties.Find("nativeclass") ' Find the location of the "nativeclass" mandatory property
qtWinListIdent.MandatoryProperties.Remove intPosition ' Remove the "nativeclass" mandatory property from the list
If qtWinListIdent.AvailableProperties.Find("items count") <> -1 Then ' If "items count" is an available identification property for WinList
    qtWinListIdent.MandatoryProperties.Add "items count" ' Add it as a mandatory property
End If

' Configure the Assistive Properties
qtWinListIdent.AssistiveProperties.RemoveAll ' Remove all assistive properties
qtWinListIdent.AssistiveProperties.Add "all items" ' Add the "all items" property as an assistive property
qtWinListIdent.AssistiveProperties.Add "width", 1 ' Add "width" as the first assistive property
qtWinListIdent.AssistiveProperties.Add "height", -1 ' Add "height" as the last assistive property
qtWinListIdent.AssistiveProperties.MoveToPos 2, 1 ' Move the second assistive property (currently "all items") to the first position in the list
' Configure the Smart Identification
qtWinListIdent.EnableSmartIdentification = True ' Enable the smart identification mechanism for the WinList object
If qtWinListIdent.BaseFilterProperties.Count = 0 Then ' If there are no Base Filter properties
    qtWinListIdent.BaseFilterProperties.Add "x" ' Add the "x" property as a base filter property
    qtWinListIdent.BaseFilterProperties.Add "y" ' Add the "y" property as a base filter property
End If
qtWinListIdent.OptionalFilterProperties.Add "abs_x", 1 ' Add "abs_x" as the first optional filter property
qtWinListIdent.OptionalFilterProperties.Add "abs_y", 2 ' Add "abs_y" as the second optional filter property

Set qtWinListIdent = Nothing ' Release the WinList identification object
Set qtIdent = Nothing ' Release the ObjectIdentification object
Set qtApp = Nothing ' Release the Application object