Get Text Action Icon

Get Text

 

Declaration

<AMGETTEXT WINDOWTITLE="text" OBJECTNAME="text" OBJECTCLASS="text" OBJECTTYPE="text" CHECKOBJECTNAME="Yes/No" CHECKOBJECTCLASS="Yes/No" CHECKOBJECTTYPE="Yes/No" RESULTVARIABLE="text" TEXTPROPERTY="text(options)" />

See Also

Check | Click Mouse | Get Selected List Item | Get Selected Tree Item | Hold Down Key | Move Mouse | Move Mouse to Object | Press | Release Key | Select Item | Select List Item | Select Tree Item | Send Keystrokes | Set Text

Description

Extracts the text contents of a control on a window and populates a variable with the results. To select an object from an existing window, either use the "Browse..." button or drag the AutoMate icon to the area on the screen. To search for partial window titles, use wildcard characters (i.e. * and ?). Note that you can only select objects that contain text.

IMPORTANT: Only standard Windows text controls will work with this action. Many applications use images or other controls that may act like a text control but they are not a native Windows control. This action will not work with such controls.In these cases, other actions must be used to retrieve the text such as the Copy (Clipboard) action.

Practical Usage

Used to retrieve the contents of a text control on a Window. Using the Get Text action is superior to using the Copy (Clipboard) action or other methods (where it is able to be used) because it communicates with the target control natively and the application is not required to be in the foreground for the event to occur.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

Populate variable with text

Text

Yes

(Empty)

RESULTVARIABLE="theVar"

The name of an already existing variable that should be populated with the text contents of the desired control at runtime.

Get text from

Text (options)

Yes

Auto-detect

RESULTVARIABLE="theVar"

Every control in Windows has both a "name" and "value" property. For example, in Internet Explorer a "link" control returns the text displayed on the page for the Name property, and the target URL for the value property. These options allow the user to control which property should be retrieved when "getting" the text. The available options are:

  • Auto-detect: The action will choose which property to use based on populated values. If the Name property is populated with text and Value property is blank, then Name will be used. If the Value property contains text and the Name property is blank, then Value will be used. If both properties are populated, Name will take precedence over Value.

  • Value property: The "value" property will be returned.

  • Name property: The "name" property will be returned.

Select the target control by dragging the AutoMate icon to the desired object. Doing so will populate the Object Description section with the characteristics of the control. Click the Edit button to access/edit the following properties:

Window Title must be

Text

Yes

(Empty)

  1. WINDOWTITLE="Desktop"

  2. WINDOWTITLE="*Explorer*"

  3. WINDOWTITLE="*"

If enabled, specifies the title of the Window that the control search should be restricted to. This value is case-insensitive. A Window title is required because without this parameter the action would have to search every control of every single Window on the system which would take an unacceptable amount of time. This parameter supports wildcards (* and ?), for example "*Internet Explorer* would include all Windows containing that text.

NOTE: If this parameter is left blank, the action assumes it is searching for a Window title that is blank - to ignore the Window title, use *.

Window Class must be

Text

No

(Empty)

WINDOWCLASS="Outlook Express Browser Class"

If enabled, specifies the class of the Window to act on. This value is case-insensitive. This parameter supports wildcards (* and ?), for example "*Internet Explorer* would include all window classes containing that text.

NOTE: If this parameter is left blank, the action assumes it is searching for a Window class that is blank - to ignore the WIndow class, use *.

Window Handle must be

Number

No

(Empty)

WINDOWHANDLE="555735"

If enabled, specifies the handle of the Window to act on. If set to 0 or omitted, this parameter is ignored.

Object type must be

Yes/No

Yes

Yes

CHECKOBJECTTYPE="YES"

If set to YES, specifies that the type parameter will be checked against the control when determining a matching control. If set to NO the type of the control is ignored.

Object type (Text-box)

Text

Yes

(Empty)

OBJECTTYPE="PushButton"

Specifies the type of control that should be checked. This parameter is ignored if the Object type must be parameter is set to NO.

Object class must be

Yes/No

No

No

CHECKOBJECTCLASS="YES"

If set to YES, specifies that the class parameter will be checked against the control when determining a matching control. If set to NO the class of the control is ignored.

Object class (text-box)

Text

No

(Empty)

OBJECTCLASS="SysTreeView32"

Specifies the class of the control that should be checked. This parameter is ignored if the Object class must be parameter is set to NO.

Object name must be

Yes/No

No

No

CHECKOBJECTNAME="YES"

If set to YES, specifies that the name parameter will be checked against the control when determining a matching control. If set to NO, the name of the control is ignored.

Object name (text-box)

Text

No

(Empty)

OBJECTNAME="Cancel"

Specifies the name of control that should be checked. This parameter is ignored if the Object name must be parameter is set to NO.

Object value must be

Yes/No

No

No

CHECKOBJECTNAME="YES"

If set to YES, specifies that the value parameter will be checked against the control when determining a matching control. If set to NO, the value of the control is ignored.

Object value (text-box)

Text

No

(Empty)

OBJECTVALUE="1"

Specifies the value of control that should be checked. This parameter is ignored if the Object value must be parameter is set to NO.

Object position must be

Yes/No

No

No

CHECKOBJECTPOSITION="YES"

If set to YES, specifies that the X and Y coordinates will be checked against the position of the control when determining a matching control. If set to NO, the position of the control is ignored.

NOTE: The X and Y coordinates specified are relative to the Window specified in the Window Title Parameter (not the screen).

Position X

Text

No

(Empty)

OBJECTXPOS="80"

Specifies the X coordinate position of the control relative to the Window specified in the Window title must be parameter. To specify variable coordinates, use wildcard characters (i.e. * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

Position Y

Text

No

(Empty)

OBJECTYPOS="90"

Specifies the Y coordinate position of the control relative to the Window specified in the Window title must be parameter. To specify variable coordinates, use wildcard characters (i.e. * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Notes

Expressions, Variables and Functions

All text fields allow the use of expressions such as variables, functions or AutoMate extended functions, which can be entered by surrounding the expression in percentage signs (example: %FileDateTime(myVar)% or %myVar%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on function

More on extended functions
More on the expression builder

Window Dissection™ Technology

This action contains a subset of Network Automation's unique "Window Dissection Technology".

Click here for more information

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Get name from the object: (class = "Internet Explorer_Server", name = "Download Trial", type = "PushButton", value = "", X = "", Y = "", check class = "YES", check name = "YES", check type = "YES", check value = "NO", check position = "NO") and populate the variable "theVar".  The object must be in the window "Download AutoMate - Network Automation - Windows Internet Explorer".  

 

<AMGETTEXT WINDOWTITLE="Download AutoMate - Network Automation - Windows Internet Explorer" OBJECTNAME="Download Trial" OBJECTCLASS="Internet Explorer_Server" OBJECTTYPE="PushButton" CHECKOBJECTNAME="YES" CHECKOBJECTCLASS="YES" CHECKOBJECTTYPE="YES" RESULTVARIABLE="theVar" TEXTPROPERTY="name" />

 

↑ Top of Page