The Get Text activity extracts a text value (name, type, or value) from an interface element. The value of the selected element is copied to the process context variable.
начало внимание
The activity cannot be used if the process does not contain at least one context variable.
конец внимание
Activity settings
Activity settings are configured automatically when recording a process.
1. Call the radial menu in the recording mode pressing the Ctrl+Alt+Q combination, which is set by default. You can change this combination in the designer settings.
2. Click on the icon and select the process variable. You can select it from the list or create a new one by clicking the Create parameter button.
3. Now the bot will save the value of the selected element (Full name fields, for example) to the context variable, which can be used in the process.
After saving the process, the Get Text activity will be added to the process diagram.
You can change the configured settings if you need. To open the settings window, click on the activity on the process diagram.
Get list/table
Use this option of the radial menu to extract text from several interface elements. For example, you can use it to get data from the Windows Explorer elements or the 1C system elements (version 8.3.13 or later).
- Click
and select List or Table.
- Select List to extract and write elements’ values to an array. First, all the child elements will be highlighted in red.
- Select an element. Its features will be taken as an example for extracting data from other elements. The selected area will be highlighted with yellow.
Select Table to extract data and save it to the Table type variable. The setting of the extracted table data is similar to the setting of the extracted data when recognizing a list.
3. Click Continue. In the window that opens, configure the activity settings.
Table
Here you can view the elements to recognize.
Set parameters to recognize
- Parameter. A variable that will store the extracted data. When recognizing lists and tables, you can select only Array and Table type variables respectively.
- Feature to read. Indicate the data to extract:
- Name. The element name;
- Type. The element type in the string form. For example, Edit — the field for entering data, List Item — an element from the list;
- Value. The element value.
- Pattern to read — A regular expression for the text fragment search.
Regular expressions can be used without leading and trailing slashes:
.*target words.*
You can use a context variable. You can insert the pattern into the variable or even combine them:
.*{$pattern}.*
where pattern is a context variable.
Example of using regular expressions
Let's say you have a Manufacture date variable of the Date/Time type, and the MM-dd-yyyy format. Set the pattern: \d{2}-\d{2}-20\d{2} This setting allows you to read the date from the expression "Manufacture date: 09-28-2019". First, using regular expression, the robot reads the substring containing the date. Then the it converts the date to the Date/Time type. |
After saving the process, the Get Text activity will be added to the process diagram.
You can change the configured settings if you need. To open the settings window, click on the activity on the process diagram.
Parameters Tab
The Parameters tab displays the basic activity parameters, target parameters, and control parameters.
Basic parameters:
- Name. The activity name on the process diagram. Its name is set by default when adding the activity. You can change the name in this field;
- Property to read. Indicate the data to extract:
- Name. The element name;
- Type. The element type in the string form. For example, Edit — the field for entering data, List Item — an element from the list;
- Value. The element value. Only the elements intended for entering or changing data have a value, for example, a text field, a checkbox, a data field, etc.
For example, you can extract the following data from the OK button on the file saving form: element name — OK, type — Button, value — empty.
For the Notepad program: name — Text editor, type — Edit, value — the text you entered.
- Pattern to read. A regular expression for the text fragment search.
The regular expression can be used without leading and trailing slashes:
.*target words.*
You can use the context variable. The pattern can be inserted into a variable or even combined:
.*{$pattern}.*
where pattern is a context variable.
Example of using regular expressions
Let's say you have a Manufacture date variable of the Date/Time type, and the MM-dd-yyyy format. Set the pattern: \d{2}-\d{2}-20\d{2} This setting allows you to read the date from "Manufacture date: 09-28-2019". First, the substring containing the date will be distinguished from the string using the regular expression. Then the substring will be transformed to the Date/Time type considering the format. |
- Parameter. Select the process context variable for keeping the extracted text in.
Read more about target and control parameters in the "Basic activity settings principles" article.
Conditions Tab
Read more about the Conditions tab in the "Basic activity settings principles" article.
Found a typo? Highlight the text, press ctrl + enter and notify us