Good time of a day for everyone!
Some time i spend with trying to understand concept and idea of SET clipping region ACTIVITY.
I noticed that if i found element and save it in by example variable EL_O ( uielement type), Values in property window clipping region and values ClippingRegion.Rectangle are NOT THE SAME.
Screenshots of these properties of the same element ( the same time) are attached.
Dear friends ! how it works , i do my jobs (set clipping region of element left or right , down or up ) absolutely intuitive.
Most of the time, you will not want to mess with clipping regions. This is because the clipping region is set by the element itself which you used a selector on. Whenever you use the “Highlight” option or activity, this will show the square around the element which you are looking inside - this is essentially the clipping region.
See the red box? That is the clipping region, and is formed using the selector, where the clipping region is actually empty.
Whenever you want to adjust that box relative to the element, then you might change the clipping region. For example, if you need to click or look inside on a specific point on the element, because that specific element doesn’t have a selector associated with it, then you might use the clipping region. A use-case for this is looking inside a box within an element (for example a signature box), then you would resize the element to surround the box.
If using the clipping region is desired, and .net solutions are needed so you can use variables etc, then there are some solutions out there on how to set up a region inside the Set Clipping Region activity.
Thanx Clayton!
You are right about spending time etc )))
For my project i need to read ID number ( lets say) in begin of row ( pdf) and then in END if the row i have to check block for signature.
It is a lot of PDFs and they are not absolutely the same .
Paddings of one document are different than paddings of another. One document has scanned askew etc. NObody is perfect, right?
But i can read the column with ID numbers relatively good! I put the data ( scrap it in one block ) in datatable. Then i make loop for each row and use " find OCR text" with vallue of ID number , find it ( of course), set the result of in UIElement ( with their COORDINATES) and Then i try to move it in the end of row . There i expect to find the signature box. i do it.
I made some observations about behavior of SetClippingRegion activity and i can definitely say that :
New UiPath.Core.Region(New System.Drawing.Rectangle(0,-18,0,36)) with direction Translate moves the regio approximately 9 pixels (??? ) bottom.
and
New UiPath.Core.Region(New System.Drawing.Rectangle(-650,0,1300,2)) with direction TRANSLATE moves BLOCK ( defined in UIelement) approximately 650 units ( i realy want to know what is it) right !
SO. It is only my own OBSERVATION that do not have “Scientifical undergrond”.
I hope you, my dear friends, still can follow my mad story… Because we all ( me , my collegas, users ) have different screen resolution, etc. I would like to calculate ( approximately) the position of "SIgnature block "in my document.
Thats why to WATCHing and plaing with clipping regio is not enought for me,
Anyway ! Thank you for attention!
Here is an old post I made showing how I handled a signature box:
When I set up my clipping region, I used an element which I found near the box and used its rectangle’s left, top, width, and height to calculate the coordinates for my new box.
To be honest, I used trial and error until I got the box the right size using the Highlight activity.
Differences in resolution will be troublesome and the clipping region will need to be different for each different resolution. Ideally, you would run this on a machine with consistent resolution. However, I suppose you could detect the resolution and make adjustments to the clipping region calculation based on that. Off the top of my head, I am unsure how to detect resolution, but there could be ideas by searching forums or Go.
Thank you Clayton .
I do it also with “trial & error” methodes and i searched everywhere for any clear info :). But - everybody used to use word “Set clipping Region” and nobody can explain hoe it works. If i do - i should say - clipping region is a powerful tool in screen automation.
But now - )))) only my observations .
Thanks for additional info .
Hi @Maryna_Shubna,
can you please share your workflow , i am kinda stuck and not able to manage and get it work . i am trying to make a dynamic clipping region but mine is not working. it seems like that nothing will get updated.
tanks in advance