← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #268573]: Java API - FindFailed: can not find image on second monitor

 

Question #268573 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/268573

    Status: Open => Answered

RaiMan proposed the following answer:
this works with the latest nightly build having the setup-generated
sikulixapi.jar on the project's class path:

package testjava;

import java.io.File;
import org.sikuli.basics.Debug;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Image;
import org.sikuli.script.ImagePath;
import org.sikuli.script.Region;
import org.sikuli.script.Screen;

public class TestJava {

  public static void main(String[] args) throws FindFailed {
    Debug.on(3);
    Screen scr1 = new Screen(1);
    Debug.off();
    scr1.getCenter().grow(100).highlight(2).hover();
    ImagePath.add(new File(ImagePath.getBundlePath(), "images.sikuli").getAbsolutePath());
    scr1.find("logo");
    scr1.highlight(-2);
    scr1.hover();
  }  
}

--- output produced:
[debug] Debug.init: from sikuli.Debug: on: 3
[debug] RunTimeINIT: loadOptions: check: C:\Users\RaiMan\Documents\NetBeansProjects\TestJava
[debug] RunTimeINIT: loadOptions: check: C:\Users\RaiMan
[debug] RunTimeINIT: loadOptions: check: C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixStore
[debug] RunTimeINIT: global init: entering as: API
[debug] RunTimeINIT: Monitor 0 has (0,0) --- will be primary Screen(0)
[debug] RunTimeINIT: Monitor 0: (0, 0) 1920 x 1200
[debug] RunTimeINIT: Monitor 1: (-1920, 0) 1920 x 1080
[debug] RunTimeINIT: fSxBase: C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixSetup
[debug] RunTimeINIT: runs as sikulixapi.jar in: C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixSetup
[debug] RunTimeINIT: exists libs folder at: C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixLibs_201506261504
[debug] RunTimeINIT: addToWindowsSystemPath: added to systempath:
C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixLibs_201506261504
[debug] RunTimeINIT: checkJavaUsrPath: added to ClassLoader.usrPaths
***** show environment for API (build 201506261504)
user.home: C:\Users\RaiMan
user.dir (work dir): C:\Users\RaiMan\Documents\NetBeansProjects\TestJava
user.name: RaiMan
java.io.tmpdir: C:\Users\RaiMan\AppData\Local\Temp
running 64Bit on Windows (6.3) from a jar
java 7-64 version 1.7.0_65-b19 vm 24.65-b04 class 51.0 arch amd64
app data folder: C:\Users\RaiMan\AppData\Roaming\Sikulix
libs folder: C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixLibs_201506261504
executing jar: C:\Users\RaiMan\AppData\Roaming\Sikulix\SikulixSetup\sikulixapi.jar
*** classpath dump sikulix
  0: /C:/Users/RaiMan/AppData/Roaming/Sikulix/SikulixSetup/sikulixapi.jar
*** classpath dump end
***** show environment end
[debug] RunTimeAPI: global init: leaving
[debug] RunTimeAPI: initAPI: entering
[debug] RunTimeAPI: initAPI: leaving
[debug] RunTimeAPI: loadLib: VisionProxy.dll
[debug] Mouse: init
[debug] KeyBoard: init
[debug] Screen: initScreens: multi monitor mouse check
[debug] Screen: *** checking: S(0)[0,0 1920x1200] center: (960, 600) --- OK
[debug] Screen: *** checking: S(1)[-1920,0 1920x1080] center: (-960, 540) --- OK
[log] highlight R[-1010,490 100x100]@S(1)[-1920,0 1920x1080] E:Y, T:3.0 for 2.0 secs
[log] highlight M[-1349,178 98x102]@S(S(1)[-1920,0 1920x1080]) S:1.00 C:-1300,229 [391 msec] for 2.0 secs 

in the first lines you can see my monitor setup.
… and in the bottom section you can see the 2 highlights, that came up as expected.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.