Reading uneditable text form a screen

Asked by swagatsamal2000@gmail.com

Hi,

I am using sikuli 1.0.1. I have an application where I need to read uneditable text. Uneditable text means- suppose a text appears on screen like " 10 Successful Entries", then I need to read the text.
Note: The next can not be selected or highlighted using mouse. The application is a java application.

Region.Text is still in experimental stage, is there any other workarround or any other jar file which i can make use of.

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

did you already try to do something like that:

Region regText = new Region(…); // whatever to get the region that contains the text to read, as little background as possible
System.out.println(regText.text()); // what do you get?

With Sikuli features, this is the only possible approach.

You might experiment with Tesseract from command line.
If this works better, you can issue a command from inside your Java Sikuli code, to get the text, after having captured the region (regText above) to an image file.

Revision history for this message
swagatsamal2000@gmail.com (swagatsamal2000) said :
#2

Thanks Raiman,

Created a region and was able to highlight the text needed. But when using the .text() - am getting the error

[error] TextRecognizer: init: tessdata folder not found at C:/SikuliX/libs/
[error] Region.text: text recognition is now switched off

i am trying it form IDE.
As part of solution - I deleted the Libs folder and tried running the setup again - but still then no luck - the folder is not getting created.

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

with 1.0.1, running setup again does not help.

you have to delete the libs folder after running setup and before starting the IDE.

Revision history for this message
swagatsamal2000@gmail.com (swagatsamal2000) said :
#4

Thanks Raiman - for your help. It's working well with Sikuli IDE. i tried and am able to retrieve and copy the text to a notepad.
Appreciate your help.

But when I am using eclipse with Sikuli JAR of version 1.0.1 - it is not accepting Region(int,int,int,int) as either a method or constructor with class object.
PSB the piece of code which is working fine in IDE but not in Eclipse with Sikuli JAR version 1.0.1: Please advise.
m=find("image.png")
x1 = m.x
x2 = m.y
reg = Region(x1-130,x2,120,25) - *** This step is throwing error with eclipse. Not able to create a region ***
reg.highlight(3)
val = reg.text()
openApp("C:\\Windows\\system32\\notepad.exe")
wait(5)
type(val)

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

-- what error?

-- you are running in Eclipse with the PyDev plugin?

Revision history for this message
swagatsamal2000@gmail.com (swagatsamal2000) said :
#6

Change to region (Java.security.cert crt path validation exception) - this is the error message we are getting.

No we are not using PyDev plugin.
We are using Eclipse 4.4 Luna version and importing sikuli jar files, trying to develop and migrate our codes.

Any package we are missing ? Please let us know.

For java jar files some imported files are listed below
For e.g. Sikuli Jar file 1.0.1, 1.0.1jar, core-1.0.1jar, java.jar, xmlbeans-2.3.0.jar, poixmlschema.3.9jar, poi.3.11jar etc. please advise.

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

--- For java jar files some imported files are listed below
please use the exact file names for the Sikuli stuff

Revision history for this message
swagatsamal2000@gmail.com (swagatsamal2000) said :
#8

hi Raiman - sorry for the delay.

The exact jar files imported to work with sikuli stuff are listed below:
sikuli-api-1.0.1.jar
sikuli-core-1.0.1.jar
sikuli-jara.jar

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

you have a mix of 2 different Sikuli flavours:

sikuli-api-1.0.1.jar
sikuli-core-1.0.1.jar
are from
https://code.google.com/p/sikuli-api/

sikuli-java.jar
indeed is from SikuliX 1.0.1

you have to decide for one of these packages.

If you decide for SikuliX:
I recommend to switch to 1.1.0

Revision history for this message
swagatsamal2000@gmail.com (swagatsamal2000) said :
#10

Thanks Raiman for the answer.

Could you please clarify a little more to what you have instructed. If I am not wrong - Do I need to remove all jars related to 1.0.1 and import same jar files with version 1.1.0. Appreciate your help.
Thanks again.

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

Removing the jars completely is not necessary, just take care, that they are not referenced in any environment setting, when you build or run your stuff.
Some folders with a naming concept should help to keep things apart.

For 1.1.0 start at
http://sikulix.com

read through the tab QuickStart and follow the instructions on the nightly build page.

Can you help with this problem?

Provide an answer of your own, or ask swagatsamal2000@gmail.com for more information if necessary.

To post a message you must log in.