Create a User-Defined Object and Set Its Object Identification Properties
Source code
'************************************************************************************************************************
'Description:
'
'This example opens UFT and creates a user-defined object of class "MyCustomListView", which is mapped to
'a WinListView test object. Once the object is mapped, the settings for mandatory, assistive, and smart
'identification properties are set just as they would be for any regular test object class.
'Assumptions:
'UFT is not open.
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtOptions 'As QuickTest.WindowsAppsOptions ' Declare a Windows Application Options object variable
Dim UserDefObj 'As Object ' Declare a user-defined object variable

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

Set UserDefObj = qtApp.Options.ObjectIdentification("WinListView").CreateUserDefinedObject("MyCustomListView") ' Create a user-defined object.
UserDefObj.OrdinalIdentifier = "location" ' Set the selector type for the created user-defined object
UserDefObj.MandatoryProperties.RemoveAll ' Clear the MandatoryProperties list.

' Create a new MandatoryProperties list
UserDefObj.MandatoryProperties.Add ("attached text")
UserDefObj.MandatoryProperties.Add ("nativeclass")
UserDefObj.AssistiveProperties.RemoveAll ' Clear the AssistiveProperties list.
' Create a new AssistiveProperties list
UserDefObj.AssistiveProperties.Add ("window id")

' Clear the smart identification settings.
UserDefObj.EnableSmartIdentification = False
UserDefObj.BaseFilterProperties.RemoveAll
UserDefObj.OptionalFilterProperties.RemoveAll

Set UserDefObj = Nothing ' Release the user-defined object.