Can I get the text of screenshot?

Asked by Angélica

I need to check values of any graphics component or to search text.
I was using find ("text"), but it doesn't work, only work with screenshot.

Thanks,

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Angélica
Solved:
Last query:
Last reply:
Revision history for this message
Karl (k-d) said :
#1

Please provide more information.

Revision history for this message
Angélica (angelica-guaman-albarracin) said :
#2

Hello Karl,

There is a question with the solution for this problem. https://answers.launchpad.net/sikuli/+question/170686

If you have other solution, I would like to know it.

Thanks,

Revision history for this message
Angélica (angelica-guaman-albarracin) said :
#3

I want to get the text of a screenshot with spaces. This screenshots are label, textfield.

Revision history for this message
Angélica (angelica-guaman-albarracin) said :
#4

I'm looking for text on my screenshot.

I use the next line: channels.find("1459763190094.png").highlight(2), with this recognize the Label. But with this (channels.find("CH1").highlight(2) ) recognize other Label. I don't understand because have the same text.

In the case of the text show the next error: [error] Image: could not be loaded: file:/C:/Users/3319/Desktop/Ejemplos de Sikuli/EjemploScanManger.sikuli/CH1.png

Revision history for this message
Karl (k-d) said :
#5

In Sikuli 1.0.1 Ihad OCR searching activated when I used a find with text input, but I get the same error you have when I do it now.
I tried using Settings.OcrTextSearch = True, and Settings.OcrTextRead = True and made sure "allow OCR" is activated in "more options...".
https://answers.launchpad.net/sikuli/+faq/2436

If you just want the text and not the location, you can use channels.text().
You can also compare this to the channel number you want, you can use channels.text() == "CH1".

Revision history for this message
Angélica (angelica-guaman-albarracin) said :
#6

I use Settings.OcrTextSearch = True and Settings.OcrTextRead = True, but doesn't recognize the text 100%.

The value returned for the function text is "CHI", but my channel is "CH1"

Revision history for this message
RaiMan (raimund-hocke) said :
#7

A common problem with SikuliX's text feature: not very reliable and by far not exact.
Results depend on font and size of the text.

You either have to live with this problems or have to use another approach.

If it is a web app, you might have a look at Selenium.

Revision history for this message
Angélica (angelica-guaman-albarracin) said :
#8

thanks Karl and RaiMan.