"GET_DESKTOP_VALUE" Command

Description: This command is used to retrieve values from desktop screens or from the clipboard and assigns a values to a variable. Reference points for the elements include desktop locators or by OCR Use Text option. For Linux and MacOS users, some libraries are required for installation and the command will navigate to instructional pages on how to install these libraries. For Windows users, please make sure Microsoft Visual C++ 2015-2019 is installed.

Usage Scenario: Suppose we have a .docx document as below that contains 8 random lines determined by a prefix ‘Line number:’ and we want to get the content next to the 5th line and store it in a variable.

Procedure: Define steps that lead up to the point where the document is opened. Then use Get_Desktop_Value command, enter a variable name, select “Text Recognition” as Read Type and select “Text” as Result Type. The reference point in this command is “Line 5:”, so we will need to define a Desktop locator for this text only. Once a Desktop locator is defined, we will need to determine how to move from “Line 5:” to the text next to it using Offset points and extend the region dimensions using Extension field. For the purpose of this example, we used 60 horizontal offset points ( X ) and 600 extension points to the right. The step will look as below:

image-20240611-154521.png
  • NOTE: The Similarity field is to adjust the matching approximation (minimum of 0.10 - maximum of 0.98 - default of 0.75) which improves the accuracy of matching the exact image in the case of multiple images with similar appearance.

Tip: Read Types:

A- Text Recognition: This type uses OCR to read the text and assign it to a variable name

B- Clipboard: This type copies the text value to your clipboard and assigns it to a variable, but only works with input fields, not labels.

Desktop commands are controlled by Locator Timeouts under User Execution Preferences. If the locator timeout is not sufficient enough for the command to find the element, you can increase Locator Timeout to give the step more time to work. It’s recommended to use 20 seconds for desktop commands.

Notes:

  1. If you do not see any highlight during execution, please enable the option Desktop Highlight under User Execution Preferences and save.

  2. Offsets can be used to to shift the search region from the supporting element. This field accepts positive and negative values. The X field will shift horizontally (positive value = move to the right / negative value = move to the left) and the Y field will shift vertically (positive value = move downwards / negative value = move upwards)

  3. Extensions can be used to extend/shrink the area to interact with as seen by the highlight during execution. This field accepts positive and negative values.

  4. Crop Region Offset can be used to designate an area for execution to look through to reduce execution duration and ensure additional accuracy. The values provided will crop the area. For example, if you provide 50 points in the Left field, only the 50% of the right side of your screen will be interacted with.

  5. Multiline can be used to interact with text which is visible on multiple lines.

The following video demonstrates how these steps get executed:

 

Related pages