Select from and too

Dave Burns
July 15, 2016 15:09 NONE
Hi

I have a (citrix) screen showing items in a recycle bin, I am trying to automate selecting a whole page and deleting as we can have over 3000 records a day added to the recycle bin.

There is no select all option on this page, so a person would click top record and shift click bottom record and click delete button.

I am not sure the best way to replicate this in a workflow, even a page at a time.

Thanks

Dave

Dave Burns July 15, 2016 15:51
If I could simulate clicking and holding the left button while scrolling down would achieve the same result

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:

  1. Click on first item (do a click relative to some static element of the window header).

  2. Try one of the following:

a. Send hotkey shift+end

b. Send hotkey shift+pgdn

  1. 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:

  1. Do a scrape relative from the recorder (green as element, yellow as region, it can be this or some other column) with GetWordsInfo = True.

  2. Save it.

  3. In the GetOCRText activity add a variable to store WordsInfo (f.e. wInfo of type IEnumerable<UiPath.Core.TextInfo>).

  4. 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

1 Like

Andrzej.Kniola July 15, 2016 16:54
Please disregard the other option, it has messed up offsets. If I’ll have time I’ll check how to correct it (in the solution I needed to do I was using FindImage more and getting it’s absolute position, hence limiting the times I needed to offset the clipping region).

Dave Burns July 15, 2016 16:58
Thanks for your help

Andrzej.Kniola July 15, 2016 17:28
Got it - screenshot below:

  1. Find relative image and GetOCRText are from the recorder.

  2. Removed one Reset clipping region.

  3. Changed setting clipping region in the if to: Translate, LastElement.Region.

  4. In the Click, Set CursorPosition:OffsetY to -10 (might need to experiment with it), as at least for me it was clicking always a little below the element.

Tested with different window positions and it seems to be working ok. Sorry for the initial confusion :slight_smile:

Regards,

Andrzej

Nitin Safaya July 19, 2016 09:55
Why cant you just right click and click on ‘Empty the recycle bin’ and then click on OK button.?

Dave Burns July 19, 2016 11:20
Unfourtunatly we are not talking about the Windows recycle bin.

Thanks

Andrzej.Kniola July 19, 2016 18:12
Hi again Dave,

Were you able to solve the case?

I was thinking of one more possible solution, using TypeInto activity (thanks to some other topic I was directed at some old documentation that is still valid).

This requires using hardware events (no checkboxes):

  1. Click first item, f.e. via click relative

  2. TypeInto the window (single activity): “[d(ctrl)][k(end)][d(shift)] [u(shift)][u(ctrl)]”

  3. Delete the files, f.e. TypeInto: “[k(del)]y”

What point 2 does is:

Hold down ctrl

Press end

Hold down shift

Press space - there is just literal spacebar between [d(shift)] and [u(shift)] that is easy to miss. If you want it more visible you could change the expression to “[d(ctrl)][k(end)][d(shift)]” + Space(1) + “[u(shift)][u(ctrl)]”

Release shift, release ctrl

Documentation for it is at the end of https://github.com/UiPath/SDK/wiki/UiNode-Methods#WriteText

This solution, assuming it’s suitable for you (maybe different keys are needed), looks much simpler and will definitely be faster.

Regards,

Andrzej

Edit: Made the space in the expression explicitly mentioned in the description.

Dave Burns July 21, 2016 12:48
Hi Andrzej

Last option worked a treat, thanks for all your help/

Dave

Hi,
I have similar scenario. I need to select one server from the list but it is using Citrix. Any help please ?