Screen Text Returns "---no text---"

Asked by Nael Abd Aljawad

i'm using Java to get image text.
Java Code:
                        Settings.OcrTextSearch = true;
   Settings.OcrTextRead = true;
   screen.wait(imagePath, 10);
   screen.find(imagePath).text();

Last code line returns "no text", but while using tha IDE i get exact text.
What is the problem ? i have the same java code in another machine and it's working!
I have installed the package of OCR.

************************************************
Maven Dependencies i use:

<dependency>
   <groupId>org.sikuli</groupId>
   <artifactId>sikuli-core</artifactId>
   <version>1.2.2</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/com.sikulix/sikulixlibswin -->
  <dependency>
   <groupId>com.sikulix</groupId>
   <artifactId>sikulixlibswin</artifactId>
   <version>1.1.0</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/com.sikulix/sikulixapi -->
  <dependency>
   <groupId>com.sikulix</groupId>
   <artifactId>sikulixapi</artifactId>
   <version>1.1.0</version>
  </dependency>
**************************************************************************

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

----- this is sufficient:
<dependency>
   <groupId>com.sikulix</groupId>
   <artifactId>sikulixapi</artifactId>
   <version>1.1.0</version>
</dependency>

it will take care for sikulixlibswin automatically.

------ <dependency>
   <groupId>org.sikuli</groupId>
   <artifactId>sikuli-core</artifactId>
   <version>1.2.2</version>
</dependency>
does not belog to SikuliX (other project) and should not be used in the same project together with sikulixapi.

----- Java Code:
   Settings.OcrTextSearch = true;
   Settings.OcrTextRead = true;
   Match m = screen.wait(imagePath, 10);
   System.out.println(m.text()); // no need to search again

"---no text---" simply means, that nothing could be read.

Revision history for this message
Nael Abd Aljawad (nael-null) said :
#2

I fixed it but still not working.
It's really strange! i run the same code on 2 different machines and i get different results!

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

-- same code on 2 different machines and i get different results!
... absolutely possible, since the result on the other machine depends on the graphics/fonts setup.
If it is not exactly the same you will always get different results or even no result as in your case.

Revision history for this message
Nael Abd Aljawad (nael-null) said :
#4

Only to adjust graphics settings ?

Revision history for this message
Nael Abd Aljawad (nael-null) said :
#5

Can you be more specified about graphics/fonts setup? How to check that in windows.

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

All the different Windows settings, that change the appearance (background, themes, fonts, ...)

Can you help with this problem?

Provide an answer of your own, or ask Nael Abd Aljawad for more information if necessary.

To post a message you must log in.