In the previous videos, we discussed setting up Citrix automation by using an image as
a relative point in order to perform actions or retrieve data.
Another very useful technique we learned to capture data in Citrix is by sending keyboard
commands like copy and paste, selecting a text, tabbing, and so on. Using these commands
we can transfer data through the Shared Clipboard.
Today instead of using an image, we will use scraped text as our reference point. This
technique is very useful because it makes our Citrix automation much more reliable and
flexible.
Let's take a look at the "Create Expense" button in our sample Citrix app. In the previous
lesson, we used Find Image activity to find this image and set a click event relative
to the image.
At some cases, other systems may have a different display and UI properties. Sometimes user
changed the default font of the system or changed the style and color properties of
the Windows apps and buttons. In this case, the Image capture won't be reliable.
I am going to show another alternative by setting up the reference point based on a
scraped text.
Let's open the recorder and let's select Step-by-step. Then we select Text>Mouse> Click.
Let's click the remote desktop window. This will run the OCR and will display all the
text in the Screen Scraper Wizard window.
Let's say we want to click the text field next to Email. What we need to do is copy
the text "Email:" and paste it under "Text to be found". The next thing is we will set
the point relative to the label Email, so we click on this option, "Set mouse position".
This will automatically highlight the image "Email". Then we can indicate the point where
want to click.
Let's test the activity we have created by clicking the Test Click button.
Let's see if it works. Yes, It works. As you can see the location of the cursor has changed.
Once you have confirmed its working, we can press "Continue".
Now that we have positioned our cursor, the next thing we will do is to send a type command
which will type in the email address. Let's go to "Elements", Keyboard, Type. Let's click
the remote desktop window then type in the input data.
Let's put a check on the "Empty Field". This will clear out the text before putting our
input data. Then, we can press "Enter".
Let's do the same with the Employee number. In our recorder, let's select Text, Mouse,
Click. Then let's click the remote desktop window.
In our Screen Scraper Wizard, let's select "Employee number:" and paste it here. Then
we set the mouse position by clicking this link.
In our remote desktop, the Employee number has been highlighted. Let's click the "indicate
a point on the screen". Then let's click next to it.
Ok. Let's do a Test Click. It works. Let's press "Continue".
Let's now create an activity to type in the Employee number. Let's select Element>Keyboard>Type.
Let's click the remote desktop window and let's type a sample number. Let's empty the
field before typing our data. Then we can press Enter.
Let's setup our last activity for the "Create Expense Report" button.
We follow the same strategy by running the OCR to get the text from the button.
What do you think is the next step? You're right.
Let's click on Text, Mouse, Click. Then we click the remote desktop window. This again
will open the Screen Scraper Wizard window. Let's highlight and select "Create Expense
Report".
This time we don't need to set the position of the mouse. The highlighted text will click
automatically in the center of the text.
Let's test it.
There. It works!
Let's go back to the wizard window and press "Continue"
That's it! Let's go and save our Recording!
Let's open our workflow and review what we have done.
The workflow initializes by reading the remote desktop window.
The first Activity, runs the OCR and finds the label "Email:" and set's its click point.
You can see that it uses Microsoft OCR as its OCR engine.
Then we sent the Type activity.
Next, we also have the click event which runs an OCR for the Employee number. Then we set
the type activity.
Lastly, we have set a click activity on the "Create Expense Report" button. In the properties
section on the right. The X and Y Offset is set both to 0. That means the click will happen
in the center of the element.
Let me go back to the app and change the data in it then we will test the workflow.
We're ready. Let's run our workflow.
There you go. It runs perfectly! As you can see there are a few delays between activities.
That's because the OCR is running on each activity.
There you have it! That's how you use OCR in Citrix Automation.
Thanks for watching!