Getting multiline text

Asked by Preeti

How to get a multiline text from a region in sikuli IDE. I am currently using this

x=list(findAll("1328085716304.png"))
for z in x:
    sleep(0.2)
    m = z.right().text()
    print m #gives the output as "SuperSaver HDHP with "

The text on the UI is "SuperSaver HDHP with HSA - $5000 deductible, no OV and no RX"(This text is in 3lines)

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

do the matches returned by findAll("1328085716304.png") have the position and height, so that the region m.right() contains the text lines as you expect?

You might visualize it using:

x=list(findAll("1328085716304.png"))
for z in x:
    sleep(0.2) # not necessary
    m = z.right()
    m.highlight(2); wait(1)
    print m.text()

the wait(1) is needed to wait for the red frame to vanish (otherwise disturbs the text() feature)

another optimization:
limit the right(), so that it only extends to the end of the text (+some margin):
e.g.
m = z.right(200)

your m = z.right().text() might contain something on the far right side, that irritates the OCR feature.

Can you help with this problem?

Provide an answer of your own, or ask Preeti for more information if necessary.

To post a message you must log in.