Using the Function search method

You can use the Function search method to create a custom algorithm that locates controls that are stored in the application repository during playback. For example, you can use a search algorithm that includes and/or conditions. The function is executed during recording and playback and must return True to locate the control.

You may want to use the Function search method if a control is not located after you:

Note: Only use the Function method if you are familiar with creating functions and understand how changing search options can impact scripts. Scripts will not work if you use this search method incorrectly.

Creating the search function

1. Select a window or control in the Application Repository pane and choose File > Properties.

The Properties dialog box opens with the Search Method tab selected.

2. Select Function from the Search method list. The following code is automatically added to declare the function:

Function ControlName(controlData)

End Function

3. Add the function to use to locate the control.

4. Click OK to save the function.

ContainsRuntimeValue statement

Returns True or False to indicate if a property is defined for a control.

ContainsRuntimeValue(ControlData,"PropertyDisplayName")

ControlData

The snapshot control data (properties).

PropertyDisplayName

Property display name to find.

GetRuntimeValue statement

Returns the value of a control property. Use the ContainsRuntimeValue statement first to determine if the property is defined.

GetRuntimeValue(ControlData,"PropertyDisplayName")

ControlData

The snapshot control data (properties).

PropertyDisplayName

Property display name to find.

Note: The ContainsRuntimeValue and GetRuntimeValue statements can only be used with the Function search method.