Interactivity - Set text

Declaration

<AMINTERACT ACTIVITY="set_text" WINDOWTITLE="text" WINDOWCLASS="Text" WINDOWHANDLE="number" OBJECTPROPERTIES="Toolkit=text,Type=text,Class=text,Name=tex,Value=text,X=number,Y=number" TEXT="text" />

Related Topics   

Description

Populates text onto a control in a window. To select a control from an existing window, drag and release the magnifier icon over the desired control. Use the Browse... button to define additional properties in order to precisely specify a matching object. To search for partial window titles, use wildcard characters (* and ?).

Practical Usage

Used to set text inside of a control. This activity is superior to using the Send Keystrokes activity (where it is able to be used) because it communicates with the target control natively and the application interface or window is not required to be in the foreground for the event to occur. Can be used in conjunction with numerous activities used to retrieve text such as Get text, Read from file, Get substring, etc.

Parameters

General

This activity comprises AutoMate's Window Dissection technology to facilitate the discovery of existing window objects and controls. To select the target control:

  1. Make certain the window that contains the desired control is open and in the foreground (in front of all other open windows).
  2. Drag and release the magnifier icon over the control. If the control is supported by this activity, a green border will appear around it.
  3. Upon release, the Edit portion of the editor is populated with identified control properties. Individual controls can be enabled/disabled or their properties further modified.

Property

Type

Required

Default

Markup

Description

Text

Text  

Yes

(Empty)

...>My custom text value</AMSETTEXT>

The text that the target control should be populated with. As with every text parameter, if the data you wish to enter is contained in a variable, simply enter the variable name surrounded by percentage signs to resolve it to its contents at runtime (i.e. %VarName%).

Edit

Property

Type

Required

Default

Markup

Description

By window title

Text

Yes

(Empty)

WINDOWTITLE="Microsoft Internet Explorer"

If enabled, specifies the title of the window that the control search should be restricted to. If disabled, this parameter is ignored. Click the down arrow to select a title from the drop-down list that appears or enter a title manually in the provided text-box. This parameter supports wildcard characters (i.e. * and ?). For example,  entering *Internet Explorer* would restrict the search to only windows containing the text "Internet Explorer" in its title.

By window class

Text

No

(Empty)

WINDOWCLASS="Outlook Express Browser Class"

If enabled, specifies the class of the window that the control search should be restricted to. If disabled, this parameter is ignored. Click the down arrow to select a window class from the drop-down list that appears or enter a window class manually in the provided text-box. This parameter supports wildcard characters (i.e. * and ?). For example,  entering *Internet Explorer* would restrict the search to only window classes containing the text "Internet Explorer."

By window handle

Number

No

(Empty)

WINDOWHANDLE="555735"

If enabled, specifies the handle of the window that the control search should be restricted to. If disabled or set to 0, this parameter is ignored. Use this parameter as a way to  distinguish a particular window from other instances containing an identical title/class.

Accessibility engine

Text (options)

No

Auto

  1. ACCESSIBILITYENGINE="auto"

  2. ACCESSIBILITYENGINE="active"

  3. ACCESSIBILITYENGINE="java"

  4. ACCESSIBILITYENGINE="ie"

The accessibility engine that this activity will use to programmatically gather accurate information about a user interface in order to interact with it. The available options are:

  • Auto (default) - AutoMate will detect the best accessibility engine to use based on current properties.
  • Active - Active Accessibility will be used. Active Accessibility is Microsoft's standard for exposing information about its user interface.
  • Java - Java Access Bridge will be used, which is a technology that enables certain Java applications and applets to be visible to assistive technologies on Microsoft Windows systems.
  • Internet Explorer - Internet Explorer DOM will be used, which is the Document Object Model used to represent objects in a web page (i.e. text, images, headers, links, etc.).

Object properties

Text

No

(Varies)

OBJECTPROPERTIES=

"Toolkit=WindowsAccessibility,

Type=data, Class=DockingPane,

Name=Line,Value=text,

X=300,Y=200"

Contains standard window dissection parameters used to describe objects, controls or text inside a window. This section can be used to define additional characteristics in order to precisely designate a window or matching object. To enable/disable a specific property, check or un-check its associated check-box. To modify the value of a specific property simply enter the desired value in the Value field.   Click the Browse... button to open the Object Browser dialog, which can be used to search for additional criteria about a given window. Available object properties are described below.

Toolkit

Text

No

(Empty)

TOOLKIT=WindowsAccessibility

If enabled, specifies that the toolkit (a set of basic building units for graphical user interfaces) will be examined when determining a matching object. If disabled, the toolkit will be ignored.

Type

Text

No

(Empty)

TYPE="PushButton"

If enabled, specifies that the object type (i.e. Button, Checkbox, Trackbar) will be examined when determining a matching object. If disabled, the object type will be ignored.

Class

Text

No

(Empty)

CLASS="SysTreeView32"

If enabled, specifies that the object class (i.e. XTPToolBar, SysTreeView, MDIClient) will be examined when determining a matching object. If disabled, the object class will be ignored.

Name

Text

No

(Empty)

NAME="Cancel"

If enabled, specifies that the object name (the unique identifier for an object) will be examined when determining a matching object. If disabled, the object name will be ignored.

Value

Text

No

(Empty)

VALUE="1"

If enabled, specifies that the value of the object (which usually coincides with the Name property) will be examined when determining a matching object. If disabled, the object value will be ignored.

X

Number

No

(Empty)

X="80"

If enabled, specifies that the object's X coordinate ( a given number of pixels along the horizontal axis of a window starting from the extreme left side) will be examined when determining a matching object. If disabled, the X coordinate will be ignored.

NOTE: The X and Y coordinates are relative to the specified window as opposed to the screen.

Y

Number

No

(Empty)

Y="90"

If enabled, specifies that the object's Y coordinate ( a given number of pixels along the vertical axis of a window starting from the top-most portion) will be examined when determining a matching object. If disabled, the Y coordinates will be ignored.

NOTE: The X and Y coordinates are relative to the specified window as opposed to the screen.

 

Description

Error Causes

On Error

Example

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

Description

This task simply opens Notepad and sets a string of text onto the Notepad window.

<AMRUN FILE="Notepad" />

<AMINTERACT ACTIVITY="set_text" WINDOWTITLE="Untitled - Notepad" OBJECTPROPERTIES="Type=SelectableText,Name=,Value=,Class=Edit,X=,Y=" TEXT="This is the text to set." />