Need help for find()

Asked by Nitin Chaudhari on 2019-09-03

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:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Nitin Chaudhari
Solved:
2019-09-04
Last query:
2019-09-04
Last reply:
2019-09-03
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)

Nitin Chaudhari (cnitin) said : #2

Hi Masuo-san,
Thanks for suport.

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