The example below explains how to automate a text received as an input by using activities like Get Full Text, Get Visible Text, and Find Text Position. You can find these activities in the UiPath.UIAutomation.Activities package.
This is how the automation process can be built:
- Open Studio and create a new Process.
Note:
Open the Notepad.exe application.
- Drag a Sequence container in the Workflow Designer.
- Create the following variable:
Variable Name | Variable Type | Default Value |
---|---|---|
| String |
- Drag an Input Dialog activity inside the Sequence container.
- In the Properties panel, add the expression
"Please ask a 'YES/NO' question"
in the Label field. - Add the value
"Question"
in the Title field. - Add the variable
question
in the Result field.
- In the Properties panel, add the expression
- Drag an Open Application activity below the Input Dialog activity.
- Inside the activity, click the Indicate window on screen option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- Inside the activity, click the Indicate window on screen option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- Place a Sequence container inside the Open Application activity.
- Create the following variables:
Variable Name | Variable Type | Default Value |
---|---|---|
| String | |
| String | |
| System.Collections.Generic.IEnumerable<UiPath.Core.TextInfo> | |
| System.Drawqing.Rectangle |
- Drag a Type Into activity inside the Sequence container.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the expression
question.ToString + " ----> Yes"
in the Text field.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- Drag a Get Full Text activity and place it below the Type Into activity.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the variable
fullText
in the Text field.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- Place a Get Visible Text activity underneath the Get Full Text activity.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the variable
visibleText
in the Text field. - Add the variable
visibleInfo
in the WordsInfo field.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- Drag a Get Position activity below the Get Visible Text activity.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- In the Properties panel, add the variable
position
in the Rectangle field.
- Inside the activity, click the Indicate element inside window option. Now you can select the desired application. The GIF below shows all the steps you need to follow:
- Place a Message Box activity below the Get Position activity.
- In the Properties panel, select the Ok option from the Buttons drop-down list.
- Add the expression
"Text information"
in the Caption field. - Add the expression
"The text '" + fullText.ToString +"' is at position" + position.ToString
in the Text field.
- Run the process. Type a question in the dialog box that is automatically typed into a notepad and then processed. In the end, a message box is displayed with information about the question entered by you.
Updated 6 months ago