Need help for find()

Asked by Nitin Chaudhari

Hi Team,
Thanks for wonderful support.

Would like to find region and would like to get text for found region.
This worked well if we have region visible on screen. sample code below
new_reg = find(sample1.png)
new_reg.highlight(1)## highlighting for debugging purpose
uprint(new_reg.text())## text fetched in region

But same find funtion is not useful; if the region is not visible on screen.
Refering Q&A found 'foundAny' can be used. Hence tried below code.
But unfortunately getting error "AttributeError: 'java.util.ArrayList' object has no attribute 'text'"
new_reg = findAny('sample1.png','sample2.png')
new_reg.highlight(1)## unable to highlight
uprint(new_reg.text())## not getting text and also throws error

Please help me in rectifying the code and is there another way to find region out of multiple images.

Regards,
Nitin Chaudhari

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Nitin Chaudhari
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

Because findAny return a list of matches for the images found.

[Example using findAny]

mm = findAny("1567505884977.png","1567505893008.png")
for m in mm:
    m.highlight(1)

Revision history for this message
Nitin Chaudhari (cnitin) said :
#2

Hi Masuo-san,
Thanks for suport.

Yes it worked as I added findAny as suggested.
助かりました。どうもありがとうございました。