Andrzej.Kniola July 15, 2016 16:08
Hi Dave,
Assuming standard hotkeys do not work (ctrl+A would be the obvious solution, but I guess you already checked that), you could:
-
Click on first item (do a click relative to some static element of the window header).
-
Try one of the following:
a. Send hotkey shift+end
b. Send hotkey shift+pgdn
- Send a delete and confirm.
If none of the 2 options work, there is a more complicated method which I needed to use recently:
EDIT: Below is incorrect, as the WordsInfo returns a relative position inside the yellow rectangle (current clippingRegion), which needs to be offset by its position in the window and the window position on the screen. If I’ll have time I’ll check how to do it, but it hopefully should give an idea anyway.
Assuming similar layout to the screenshot below:
-
Do a scrape relative from the recorder (green as element, yellow as region, it can be this or some other column) with GetWordsInfo = True.
-
Save it.
-
In the GetOCRText activity add a variable to store WordsInfo (f.e. wInfo of type IEnumerable<UiPath.Core.TextInfo>).
-
Select last or default from the IEnumerable (UiPath.Core.TextInfo lastElement = wordsInfo.LastOrDefault)
5 If lastElement IsNot Nothing then:
5a. Set clipping region: Rectangle, Region = lastElement.Region
5b. Add a Click (in options set KeyModifiers = Shift, but no other arguments)
5c. Set clipping region: Rectangle, Size: (0,0,0,0) to reset it to whole window again.
This should essentially simulate clicking on the first element, then visually finding the last row and clicking on it with Shift.
Make sure to use UiPath.Core.TextInfo, as it is different than default TextInfo.
If you want to click on each of the elements, instead of selecting region of last element, you could do a foreach loop with the same structure, but since it’s just deleting, then it would be the same as just clicking the first one over and over again.
Hope this gives you a way to proceed.
Regards,
Andrzej