Returns the number of items contained in the specified menu item's sub-menu (if any).

PropertyValue

Required. A Variant. The expected value against which the actual item property value should be checked. You can either use a simple value or you can use a comparison object together with the value to perform more complex comparisons.

TimeOut

Optional. An unsigned long integer value. The time, in milliseconds, within which UFT should check whether the actual value of the item property matches the specified expected value. If no value is specified, UFT uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box.

Return Type

A Boolean value.

Returns TRUE if the item property achieves the value, and FALSE if the timeout is reached before the item property achieves the value.

A TRUE return value reports a Passed step to the run results; a FALSE return value reports a Failed step to the run results.

IMPORTANT

If the expected and actual values do not match, an error is reported and the test or component status is changed to failed.

Note: For test run synchronization, or whenever you do not want to fail the test if the expected and actual values do not match, use the WaitItemProperty method.

You can also use comparison objects to perform more complex value comparisons. For example, you can instruct UFT to check whether a specific item property value is greater than the specified value.

An example of the syntax required when using a comparison object is: Object.CheckItemProperty 2, "text", micNotEqual("John")"

micLessThan: Less than; Specifies that UFT checks whether the item property value is less than the specified value.

micGreaterThanOrEqual: Greater than or equal to; Specifies that UFT checks whether the item property value is greater than or equal to the specified value.

micLessThanOrEqual: Less than or equal to; Specifies that UFT checks whether the item property value is less than or equal to the specified value.

micNotEqual: Not equal to; Specifies that UFT checks whether the item property value is not equal to the specified value.

micRegExpMatch: Regular expression; Specifies that UFT checks whether the item property value achieves a regular expression match with the specified value. Regular expressions are case-sensitive and must match exactly. For example, 'E.*h' matches 'Earth' but not 'The Earth' or 'earth'.

When the types of the expected value and actual value do not match, the comparisons are performed as follows (in this order):

Empty values: Empty values may be an uninitialized variable or field (which returns TRUE for the IsNull function in VBscript) or initialized to an empty value (which returns TRUE for the IsEmpty function is VBscript). When trying to compare two arguments when at least one is an empty value, the comparison assumes equality for two uninitialized arguments and for two empty arguments. Any other combination is considered unequal. For example:dim vEmpty Object.CheckItemProperty 2, "text",micNotEqual(vEmpty) will not wait for the timeout (because the 'text' property value is an empty string and the argument passed to micNotEqual is an empty value, and so micNotEqual finds them not equal and returns TRUE).

String values: When trying to compare a string value with non-string value, the string value is converted to the non-string type and then compared. If the string value cannot be converted to the non-string type, the comparison assumes the values are not equal. For example:Object.CheckItemProperty 2, "text", micGreaterThan("8")"will not wait for the timeout if the 'text' property value is '16' (because micGreaterThan finds 16 to be greater than 8 and returns TRUE), but will wait if the 'text' property value is 'a' (because 'a' cannot be converted to a number).

Boolean values: When trying to compare a Boolean value with non-boolean value, the non-boolean value is converted to a boolean value and then compared. The conversion method assumes that any integer value other than '0' is TRUE, and that '0' alone is FALSE. If the conversion fails to produce a boolean value (for example, if the value is 'abc'), the comparison result will be FALSE (note that for the WaitProperty method this result would instruct UFT to keep waiting). If the conversion succeeds, the method compares the two boolean values according to the comparison logic.

Other value types: When other value types do not match, they are compared under the assumption that different types are not equal (nor greater than or less than each other).

'The following example uses the CheckItemProperty method to check whether
'first sub-item of the "Format" menu in Notepad is checked. If the expected value
'is not reached within five seconds, the step status is reported as Failed
'and the method returns False.
bSucceeded = Window("Notepad").WinMenu("Menu").WaitItemProperty("Format;<Item 1>", "checked", True, 2000)

Select Method

Description

Selects the specified item in the menu.

Syntax

object.Select Item

Arguments

Parameter

Description

Item

Required. A Variant. The full path of the menu item to select from the list. The path is composed of the menu item names or a numeric index separated by a semicolon. To specify the index of the item to select, use <Item #>. Index values begin with 1.

Note: You can use the BuildMenuPath method to build the item path string that can then be used as the Item argument for this method.

Return Type

None

Example

'The following example uses the Select method to open the Open File
'dialog box in Notepad.
Window("Notepad").WinMenu("Menu").Select "File;Open... Ctrl+O"'You can also open a menu item according to its indexed number.
Window("Notepad").WinMenu("Menu").Select "<Item 1>;<Item 2>"

Returns the number of items contained in the specified menu item's sub-menu (if any).

PropertyValue

Required. A Variant. The expected value against which the actual item property value should be checked. You can either use a simple value or you can use a comparison object together with the value to perform more complex comparisons.

TimeOut

Optional. A long integer value. The time, in milliseconds, after which UFT continues to the next step if the specified item value is not achieved. If no value is specified, UFT uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box.Default value = -1

Return Type

A Boolean value.

Returns TRUE if the item property achieves the value, and FALSE if the timeout is reached before the item property achieves the value. A FALSE return value does not indicate a failed step.

IMPORTANT

Tip: This method is useful for test run synchronization. Unlike the Exist method and the WaitProperty method, the WaitItemProperty method enables you to synchronize the test run based on a specific object item property. For example, you can instruct UFT to wait for a particular string to appear in the second panel of the "StatusBar" control:' Wait up to 30 seconds for the string "Ready" to appear in the second panel of the "StatusBar" control.Window("Test").WinStatusBar("StatusBar").WaitItemProperty 2, "text", "Ready", 30000

You can also use comparison objects to perform more complex value comparisons. For example, you can instruct UFT to wait until a specific item property value is greater than the specified value.

An example of the syntax required when using a comparison object is: Object.WaitItemProperty 2, "text", micNotEqual("John")"

The following comparison objects can be used:

micGreaterThan: Greater than; Specifies that UFT waits until the item property value is greater than the specified value.

micLessThan: Less than; Specifies that UFT waits until the item property value is less than the specified value.

micGreaterThanOrEqual: Greater than or equal to; Specifies that UFT waits until the item property value is greater than or equal to the specified value.

micLessThanOrEqual: Less than or equal to; Specifies that UFT waits until the item property value is less than or equal to the specified value.

micNotEqual: Not equal to; Specifies that UFT waits until the item property value is not equal to the specified value.

micRegExpMatch: Regular expression; Specifies that UFT waits until the item property value achieves a regular expression match with the specified value. Regular expressions are case-sensitive and must match exactly. For example, 'E.*h' matches 'Earth' but not 'The Earth' or 'earth'.

When the types of the expected value and actual value do not match, the comparisons are performed as follows (in this order):

Empty values: Empty values may be an uninitialized variable or field (which returns TRUE for the IsNull function in VBscript) or initialized to an empty value (which returns TRUE for the IsEmpty function is VBscript). When trying to compare two arguments when at least one is an empty value, the comparison assumes equality for two uninitialized arguments and for two empty arguments. Any other combination is considered unequal. For example:dim vEmpty Object.WaitItemProperty 2, "text",micNotEqual(vEmpty) will not wait for the timeout (because the 'text' property value is an empty string and the argument passed to micNotEqual is an empty value, and so micNotEqual finds them not equal and returns TRUE).

String values: When trying to compare a string value with non-string value, the string value is converted to the non-string type and then compared. If the string value cannot be converted to the non-string type, the comparison assumes the values are not equal. For example:Object.WaitItemProperty 2, "text",micGreaterThan(8) will not wait for the timeout if the 'text' property value is '16' (because micGreaterThan finds 16 to be greater than 8 and returns TRUE), but will wait if the 'text' property value is 'a' (because 'a' cannot be converted to a number).

Boolean values: When trying to compare a Boolean value with non-boolean value, the non-boolean value is converted to a boolean value and then compared. The conversion method assumes that any integer value other than '0' is TRUE, and that '0' alone is FALSE. If the conversion fails to produce a boolean value (for example, if the value is 'abc'), the comparison result will be FALSE (note that for the WaitProperty method this result would instruct UFT to keep waiting). If the conversion succeeds, the method compares the two boolean values according to the comparison logic.

Other value types: When other value types do not match, they are compared under the assumption that different types are not equal (nor greater than or less than each other).

Example

'The following example uses the WaitItemProperty method to wait
'up to two seconds until the "Format;Word Wrap" Notepad menu item
'is checked. If the expected value is not reached within two seconds,
'the method returns False and the step status is reported as Warning.
bSucceeded = Window("Notepad").WinMenu("Menu").WaitItemProperty("Format;Word Wrap", "checked", True, 2000)

'The following example uses the WaitItemProperty method to wait
'up to two seconds until the first sub-item of the "Format" menu in Notepad
'is checked. If the expected value is not reached within two seconds,
'the method returns False and the step status is reported as Warning.
bSucceeded = Window("Notepad").WinMenu("Menu").WaitItemProperty("Format;<Item 1>", "checked", True, 2000)

ExpandMenu Property

Description

Syntax

object.ExpandMenu

Value Type

A Variant.

Property type

Read-write property

IMPORTANT

The open menu to retrieve item properties option (Tools > Options > Windows Applications pane) sets the default behavior for all menu objects (selected by default). Use the ExpandMenu property to modify the behavior for a specified menu object.

Note: For better performance when running your test, you may want to set the ExpandMenu property to False (or to clear the open menu to retrieve item properties check box). (You may need to set the property to True when retrieving properties for menus that change dynamically.)