[1.1.4 ] collectWords dosn't find a word --- fixed build #216

Asked by Jan

I am new to Sikuli and I am not a developer, but I did my best to read the docs. Probably I missed anyway something for OCR-setup. I already did some successfull scipts for Html/Javascipts Apps and for some Windows-Apps. Now I want to get the text and the position of new and unknown Objects, e.g. usernames, wich I can't click/mark, because they are starting a function or a hyperlink. So collectWords() would be the best method.
This is my code:
...
Settings.OcrTextRead = True
#tr = TextOCR.start()
#tr.setLanguage("eng")
#logger.warning('tr = %s', tr)
words = Region(38,381,282,28).text()
logger.warning('words = %s', words)
#words = SCREEN.getWords() #Screen object has no attribute getWords
words = SCREEN.collectWords()
logger.warning('words = %s', words)
words = Region(19,323,675,268).findAllText("Administrator")
logger.warning('words = %s', words)
#firstWordMatch = words[0].getText()
#firstWord = firstWordMatch.getText()

Region.text() and Region.findAllText("mySearch") works fine, but this is not the function I need.
Region. collectWords(), Region. collectWordsText(), Region. collectLines(), ... don't throw an error, but find nothing: Result is [0]
When enabled getText() throws an error and color of this method call in SikuliX IDE keeps black. Color of collectWords() is not blue/green like findAllText(), but keeps black,too. ?!?
I tested this code with all kind of apps/texts and got allways the same result.

My Environment:
Windows 10, latest Java 64, Folder of Sikulix 1.1.3 installation got renamed, old Appdata-Folder of 1.1.3 got renamed.
I did same for the 1.1.4 installation wich i used until today. This Installation had both, Jython and JRuby support and some Tesseract-files.
Now I did a new installation of last night version of 1.1.4 and only Jython, nothing else. No additional configuration, only the
Settings.OcrTextRead statement in the script.
Resul of new installationt:
Nothing changed

By the way:
Do I need the tr = TextOCR.start() stuff?

Question information

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

sorry for the inconvenience - simply a bug.
It will be fixed in the next nightly build (#216)

Thanks for finding.

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

--- Do I need the tr = TextOCR.start() stuff?
No if you just use the standard Region::text features.

Only needed if you want to use special TextRecognizer/Tess4J features

Revision history for this message
Jan (jan111) said :
#3

Thanks RaiMan, that solved my question.