text search is currently switched off

Asked by emrah kara

i am using sikuli 1.0.1 on java with my maven dependincy. Tha problem is that screen.click doesn't recognize if path object is a picture to click.
screen.click ("something.png");

how can i switch it on? i dont have sikuli IDE to turn it in settings, because i clicked on 3 as i installed the new version.

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
RaiMan (raimund-hocke) said :
#1

if you mean that
screen.click ("something.png");

should search for an image "something.png" and click the match, then you have to provide a correct path to that image, so that it can be found in the file system.
It might be a relative path to your current working dir:
System.out.println(new File("").getAbsolutePath()) // will print your working dir

or an absolute path specification.

Revision history for this message
emrah kara (emrah-karakoc) said :
#2

in click methode i used always full path like screen.click(User/.../something.PNG);

Ok i found an Information.
Settings.OcrTextSearch to switch on finding text, that means Settings.OcrTextSearch = true;

but i dont understand what this means:
Settings.OcrTextRead to switch on the Region.text() function..
does it mean Settings.OcrTextRead = true; ?

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

yes, but this will the search for the text "something.png" and I am not sure if you want that.

You seem to want to click on an image, hence comment #1

Revision history for this message
emrah kara (emrah-karakoc) said :
#4

yes i want to click an image, but i get the error "text search is currently switched off", but it is actually an image path.

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

- you say: "something.png" is an image filename

- the error message says, that the image cannot be found on the file system. So Sikuli assumes, that the text "something.png" should be searched (what not is your intention), but textSearch is switched of currently (which is the standard now)
(BTW: this internal guessing was one of the meanest implementations by the former developers. In the next version you will have to explicitly say findText() if you want to search for text)

- so you have to specify a correct image path, so the image can be found (BTW: you might try ImageLocator.setBundlePath() to specify a standard directory to look for image files, or even use ImageLocator.addImagePath() to specify more than one image folder.

hope it is clear now ;-)

Revision history for this message
emrah kara (emrah-karakoc) said :
#6

Thanks RaiMan, that solved my question.