Home > Language Reference > UI Automation Functions > GetUIAProperty

GetUIAProperty

The GetUIAProperty function returns the content of the specified property for the specified UIA descriptor.

Usage

Used to test field contents or if a control is enable or not, etc....

Video: How to retrieve the content of a Windows object such the text or checked-not checked property using GetUIAProperty function.

Syntax

ret = GetUIAProperty(<uia_descriptor>, <property_name>, var$)

Parameters

<uia_descriptor>, string, UIA descriptor of the UI element to retrieve the content of the specified attribute from. Use Spy to generate this descriptor.

<property_name>, string, name of the property from which the content has to be returned. Use Spy to know the possible property names whose content can be retrieved.

var$, string, content of <property_name>.

Return value

Ret, optional numeric return code. If the function succeeds, the return value is 0. If the function fails, the return value is a nonzero value (see UI Automation Functions Error Codes).

Remarks

At replay, the function waits for the specified UI element to be loaded before retrieving its specified property content. The timeout is the value of #ActionTimeout, so 30 secs by default.

Use togglestate as <property_name> to know if a checkbox is checked (var$ returns 1), unchecked (var$ returns 0) or indeterminate (var$ returns 2). For example, is the Male checkbox checked or not:
GetUIAProperty("[APP='Application.exe',CLASS='WindowsForms10.BUTTON*',TITLE='Male']","togglestate",a$)
msgbox(a$)


Use enabled as <attribute_name> to know if a button is greyed (var$ returns false) or enabled (var$ returns true). For example, is the Delete button greyed or not:
GetUIAProperty("[APP='Application.exe',CLASS='WindowsForms10.BUTTON*',TITLE='Delete']","enabled",var$)
msgbox(var$)

See also

How to use UI Automation functions
ClickUIA
SelectUIAItem
WriteUIA

Examples

GetUIAProperty("[APP='Application.exe',CLASS='WindowsForms10.EDIT*',AUTOID='tbFirstName']","VALUE",a$)
msgbox(a$)