cancel
Showing results for 
Search instead for 
Did you mean: 

Surface Automation - Determine Start/End X and Y values for Dynamic Region

shahariar_k_bhu
Level 5
Hello, I'm not sure if I understand the concept of Dynamic Region, so I'm looking for some clarifications. As far as I understand, Dynamic Region is all about image recognition. Your image/element usually has a - Start X (or X) - End X (or X+Width) - Start Y (or Y) - End Y (or Y + height) When using Find Image Action in Image Search VBO, you usually get the X (or Start X), and Y (Start Y) values. How do I then determine the End X, and End Y values? Is it possible to get the width and height of an image by using some VBO? Maybe code works? The way I do it: I know the width and height of image by inspecting the elements. I just add them by "hardcoding" to dynamic region parameters. For example, [X] + height etc. Another instance, Let's say we have an Username Text Label element followed by an Username Text Input element. The rule is that if we always know that username input field is next to the label. In practice, what would be the easiest way to actually determine the Start/End X and Y coordinates for the input field? My method: Using Find Image, I get the X and Y coordinates of the label. I know the label width and height by inspecting Application Modeller. I also know the width and height of the input field by inspecting Application Modeller, so I "manually" add them. So Start X for input field could be [X] + (label width), and End X could be [X] + (label width) + (input field width). How do you guys determine Start/End X positions for input fields?
3 REPLIES 3

shahariar_k_bhu
Level 5
I just managed to get the height and width of an image by using a code block. This simplifies the process a bit. However, this requires me to add the input field as a data item, then get its width and height as well. Is there any simpler ways to do this? What if there is a gap between username label, and username input field? Do I fill the gap using Application Modeller, or can I calculate it?

TomBlackburn1
Level 7
Hi Shabu, - When using Find Image Action in Image Search VBO, you usually get the X (or Start X), and Y (Start Y) values. How do I then determine the End X, and End Y values? If for example you have spied the equals button on the calc application, but the image isn't within the region, as you are doing above you are searching for the image using image search and are output it's X and Y value (Start X and Start Y). Normally most people would then use a Global Mouse Click to do [X]+2 and [Y]+2 to indent the click, so it's not clicking on the border of the region. However, You can use a read stage to get the bounds of the original region around the equals button which outputs the width and height of the region. Now you global mouse click action can be [X]+([Region Bounds.Width]/2) and [Y]+([(Region Bounds.Height]/2) Hope that helps.

John__Carter
Staff
Staff
Hi Shabbu - SA is all about reading images to understand your location on the screen so that you can accurately direct input (mouse clicks and keystrokes) and output (read image, recognise text, OCR). Most of the time a field will be in a fixed position relative to the label, so it is acceptable to hard code this distance, eg FoundLabelX+OffsetX and FoundLabelY+OffsetY. Similarly, the width of fields is usually fixed, so hard coding that will be OK too.Regarding a dynamic region, think of it as 'the area to search in'. It cannot be smaller than the target image and remember that any coordinate returned after finding an image will be relative to the top left of the region.