Failed to extract multiple texts on a screen with similar images

Asked by siddu

Hi,

On a screen, have 2 similar images with name site_1 and site_2(only name difference between those images and rest is similar ) and wants to extract the texts "site_1" and "site_2" from the images with below code.

                 find(Pattern("sites.png").exact()).below(10).text()
                 find(Pattern("sites2.png").exact()).below(10).text()

Note: sites.png image has a text "site_1" and site2.png image has a text "site_2".

but i can able to extract text "site_1" only with above codes (as it placed before site_2(site2.png) on screen)
may i know how can i extract site_2 from "sites2.png"

Im using sikuli 1.1.0(with options 1 and 3) and windows machine.

Thanks in Advance

regards
Siddu

Question information

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

text() extract the text contained in the region .
Use Region() in order to adjust region .

[example:]
f = find(Pattern("sites.png").exact())
dx = 0
dy = 0
dw = 0
dh = 10
x = f.getX() + dx
y = f.getY() + f.getH() + dy
w = f.getW() + dw
h = dh
r = Region(x, y, w, h).highlight(2)
print r.text()

Revision history for this message
siddu (siddum-meti) said :
#2

Thanks masuo, that solved my question.