Sikuli 1.1 / JRuby on Ubuntu 12.0.4, Can't find images in currently active window

Asked by Cyle Hunter

I recently installed Sikuli 1.1 with JRuby on Ubuntu 12.0.4.4, I followed the setup described here for the Ruby gem: https://github.com/rssdev10/SikuliX-2014/tree/ruby/JRubyGem

I installed using the second option in the sikulixsetup-1.1.jar

I have a pretty basic program that is supposed to click on the Firefox on the Unity Launcher and then click on my gmail bookmark icon, here's the gist: https://gist.github.com/nozpheratu/89b0eb238a9158dac07a

For whatever reason, Sikuli only seems to be able to detect images in my Unity Launcher, it can detect and click on my Firefox or THunderbird icons no problem. However, it seems nothing inside of the currently active window can be read by Sikuli. I don't think it's an issue with the image not showing up in time before the search gets executed, as I've tried various combinations of wait and sleep commands to no effect. Additionally, I don't think it's an issue with the particular image I'm using, as I've tried multiple images of varying sizes in multiple applications. Anything outside of the main Unity menus simply fails to get detected.

Here's the error message that gets raised, I'm not sure what the " S(0)[0,0 1920x1080]" bit represents:

org.sikuli.script.FindFailed: can not find /home/cyle/development/jruby/sikuli-test/images/inbox.png in S(0)[0,0 1920x1080]

Am I missing a step somewhere in my gist?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Cyle Hunter
Solved:
Last query:
Last reply:
Revision history for this message
rss (rssdev10) said :
#1

1. Ruby gem now in main project: https://github.com/RaiMan/SikuliX-2014/tree/master/JRubyGem

2. The problem is using of an absolute path in your method:
def image(file_name)
  "#{Dir.pwd}/images/#{file_name}"
end

http://doc.sikuli.org/globals.html - see setBundlePath(path-to-a-folder)

3. Also see rspec examples for IDE: https://github.com/rssdev10/sikulix-ide-templates

Revision history for this message
Cyle Hunter (cylehunter33) said :
#2

I'm already using the linked Ruby gem. Why is the absolute path a problem? It seems to read the images OK, as the error I'm getting indicates it can't find the images on the screen. I'm unsure how to incorporate setBundlePath in ruby, the Gem I'm using doesn't seem to handle it at all. I tried setting the SIKULI_IMAGE_PATH variable, but that doesn't seem to work either. The only workaround I could find was to use absolute paths. I'm not using the Sikilu IDE either.

Revision history for this message
Cyle Hunter (cylehunter33) said :
#3

Please note one again that I can find images on my desktop or Unity launcher just fine, however, whatever is in the active window CANNOT be seen by Sikuli it seems.

Revision history for this message
rss (rssdev10) said :
#4

Sorry, I misled. The absolute path is really work now.... ImagePath.setBundlePath() is a part of Java Sikuli API .
Ruby-gem does not hide Java classes.

Unfortunately I haven`t Ubuntu. Try to run the following code as workaround.
screen = Region(0,0,1920,1080)
p screen.find '123.png'

This is the direct way to specify a region for search images. But I afraid the problem in Ubuntu...

Revision history for this message
Cyle Hunter (cylehunter33) said :
#5

Hey rss, thanks for the assistance. I tried the workaround, but I met the same result. I moved to windows now and everything is working great.