"DESKTOP_CLEAR" Command

Description: This command is used to clear the content of a desktop element defined by a Desktop locator, by using the focused element on screen or by OCR using Use Text option. Offset X and Y fields can be used in cases where the element appearance is different every time which could make the Desktop locator point to a different place. In such cases, an element that does not change (such as a label) can be used as an anchor and the offset points added so that the label is found and the direction is shifted from the label to this text box.

Usage Scenario (1): Suppose we want to clear the contents of Notepad file without using Desktop_Hotkeys command to select all content and another Desktop_Hotkey command to Delete.

Procedure: Define steps that open a Notepad file. Then use Desktop_Clear command with “Use Focused Component” which will automatically delete the contents of the entire file when focus is on the file.

image-20240611-145434.png

Usage Scenario (2): Suppose we want to clear the Run text box on Windows (WIN +R) but it does not always show the same content, so defining a Desktop locator may not find the correct element. In such case, we can use Desktop_Clear command to use a static object that does not change place (such as Open: label) and use Offset fields to move from this static object to the text box.

image-20240611-145457.png

Procedure: Define a step that opens Run using Desktop_Hotkeys (Win + R). Then define a step that uses Desktop_Clear command. In the Reference Point, define a Desktop locator for Open: label. Afterwards, you can specify the Offset where X controls horizontal scope and Y controls vertical scope. Let’s use 60 horizontal offset points. Your steps will look like this:

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: