get text coordinates
Name | Description | Type | Modifier |
---|---|---|---|
window | (Optional) TA name of the window. | Interface Entity | None |
control | (Optional) TA name of the control. | Interface Element | None |
rect | (Optional) Specifies the dimensions of a rectangular area which, in combination with the active UI element (as determined by the window and control arguments), defines the active area. Scanning for the search text (defined by text) is then limited to this active area (see
below). Values specifying the location of the rect area are relative to the active UI element.
| String | None |
text | String representing the to be searched for. | String | None |
index | (Optional) Specifies a particular instance of the target , in case more than one match is expected. The index of a given matching bitmap text fragment is determined by its position, relative to other matching fragments in the active area, in a left-to-right, top-to-bottom ordering, as in the manner of reading a page (Indexing starts at 1). Default Value: 1 | String | None |
left | Variable to receive the returned value of the horizontal coordinate of the top-left corner of the bitmap text fragment of interest. The value, expressed in pixels is relative to the left edge of the specified UI element (screen, window or control). | String | None |
top | Variable to receive the returned value of the vertical coordinate of the top-left corner of the bitmap text fragment of interest. The value, expressed in pixels, is relative to the top edge of the specified UI element (screen, window or control). | String | None |
text color | (Optional) Color code of the text, in hexadecimal (See below). This value is obtained from the OCR Detector Tool dialog box. | String | None |
Example - Case 1: With window and control arguments specified
window control rect text index left top
get text coordinates login login Login leftPos topPos
Example - Case 2: With index argument specified
window control rect text index left top
get text coordinates home TestArchitect 2 l_Pos t_Pos
Example - Case 3: With text color argument specified
window control rect text index left top text color
get text coordinates home Churchy Joes leftPos leftTop FEFEFE
The bitmap text fragment is an OCR-recognized string of text within a bitmap image.
- This built-in action employs both Optional Character Recognition (OCR) and Graphics Device Interface (GDI) techniques. By default, the action employs OCR technique. To switch to GDI technique, refer to the character recognition technique built-in setting for details.Important:
- When this built-in action applies GDI technique, all Windows APIs, including DrawTextA (ANSI name), DrawTextW (Unicode name), TextOutA (ANSI name), TextOutW (Unicode name), ExtTextOutA (ANSI name), ExtTextOutW (Unicode name) will be called to redraw the desired text produced by the AUT.
- Use of GDI technique for this action is supported on the following systems/platforms: Windows (Win32, WinForms).
- This action is applied to that part of the captured bitmap identified as the active area, with the remainder of the image ignored. The active area is determined by the combination of the window, control and rect arguments. To begin with, window and control determine the active UI element, which can be a control, window, or the full screen, as follows:
With the active UI element established, the rect argument then (optionally) specifies a rectangular active area relative to the active UI element (If no rect argument is specified, the active UI element itself is the active area).window argument control argument active UI element is… omitted omitted entire screen (i.e., entire captured test image) specified omitted entire application window specified specified specified control - In most cases, the rect area, if specified, defines a sectional area whose borders reside within the active UI element, so that the rect area itself is the active area. But that is not necessarily the case. The following three images illustrate the general case for how the active area is determined when the rect area is specified.
The general rule for determining the active area is as follows:
rect area: resulting active area: not specified the active UI element overlaps the active UI element the intersection space (Cases 1 & 2 above) no overlap with active UI element the active UI element (Case 3 above) - If the action fails to find the specified bitmap text fragment, an error is generated.
- rect argument:
The above figure illustrates the active area that applies when both the window and control arguments have been specified (establishing a picture control as the active UI element), and rect = 80, 30 (That is, left=80, top=30, and width and height are allowed to assume their default values).
Note that, in this case, the active area and the rect area are the same, but that is not always the case. Any of the four sub-arguments of rect may be omitted, but all values must maintain their comma-delimited places to ensure correct assignment (For example, setting rect to, , 100, 50
specifies an active area of width=100, height=50, whose top-left corner coincides with that of the active UI element). - text argument:Important:This action supports English text only.
- For OCR technique: While the case sensitive setting applies to the property values used to identify the correct window or control for this action, the action's OCR text identification functionality is non-case sensitive, and remains unaffected by the value of this setting.
- For GDI technique:
- The action's GDI text identification functionality is case sensitive, and is affected by the value of the case sensitive setting.
- It is highly recommended that you apply wildcards for this argument's value, since the text re-drawn by given drawing functions might contain surrounding noise. For example: given a value of {Administration.*}, TestArchitect searches for texts whose string beginnings match Administration. In more general terms, this argument accepts regular expressions.
- If the variables in arguments left and top have not been declared, the action creates them as globals.
- text color argument:
- No value is required if your test procedure does not make use of the built-in set ocr setting action and OCR Detector Tool.
- Otherwise, a value is required for text color, and is generally obtained through the OCR Detector Tool. This ensures that OCR-related built-in actions are able to detect the given text properly, in the same way that you would identify it manually with the OCR Detector Tool.
- This action supports the <ignore> modifier. If the string
<ignore>
is present as the value of any of the arguments, or any argument contains an expression that evaluates to<ignore>
, the action is skipped during execution.