Image search on specific areas based on the adjecent images


I have a requirement to work on a specific area i.e around the image, for example I have a text fields and corresponding check boxes adjacent to the text field as shown in the picture attached,

Now all i need is I want to uncheck the check box where the Text Name is not equal to “baseVersion” and check the corresponding check box where the Text Name is baseVersion.

I Can recognize the text Name “baseVersion” using the TIG i.e by giving the following code for it

Click (Text:“baseVersion”&" ("&1.0&")", TextSize:“12”,TextFont:“LucidaGrande”, TextColor:(0,0,0),TextBackgroundColor:(212,221,230).

Can any one please help me out

Thanks In Advance

This is actually a fairly complex operation that humans are very good at doing quickly. There might be an easier way, but perhaps this approach would work (it’s similar to the way a human user would evaluate the page):

[list]Search for all the checkboxes on the screen (checked and unchecked) and save each of the image’s properties to a list.

Starting with the first checkbox in the list, note whether the checkbox is checked or unchecked, and its location.

Create a narrow horizontal band as a search area to the right of the checkbox large enough to accommodate the label’s text height and width, and extends to includes the checkbox itself.

Now search within that band for the label (“baseVersion”), repeating with three textStyles (to accommodate the dark blue background with white text, and the light blue or white background with black text).

If the label does not match, uncheck if checked. If the label matches, check if unchecked.

Go to next checkbox in the list.
Naturally, this will involve a fair amount of script code, and I strongly recommend using functions or called scripts and passing parameters for all the repeating searches.

For example, you may be able to do something like this for the text search (this is only one step in a repeated loop):

// This handler accepts text to search along with text style attributes, and returns true or false
params label, listStyle
put imageFound(text: label, textStyle: listStyle) into result
return result -- returns either true or false

This generic function (or called script) would allow you to search any text using any text style. As a bonus, the script is re-usable across many projects if desired.

By the way, I don’t think you need the extra characters at the end of the string ("&1.0&"), unless you’ve found that the TIG needs them for reliability. It should work fine with just “baseVersion 1.0” or drop the version number from the search altogether if it is not really required.