Sikuli can't find a match on a second screen/monitor when calling a function in an included module

Bug #966536 reported by ManxBug
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

Bug Description

Sikuli-X 1.0rc2
Windows 7 Ultimate 64 bit.

Sikuli can't find a match on a second screen/monitor when calling a function in an included module.

I have a couple functions:
from sikuli.Sikuli import *

myScriptPath = "D:\\ICProjects\\sikuli\\testPOS.sikuli"
if not myScriptPath in sys.path:
 sys.path.append(myScriptPath)

scr1 = Screen(0)

def initScreen(nScreen):
 global scr1
 scr1 = Screen(nScreen)
 return scr1

def showSelectedScreen():
 global scr1
 scr1.highlight()

def ShowInfo():
 global scr1
 scr1.click(IMG)

They all work and find the IMG on the second monitor when they are called in the local script.

However when I try to call them from a master script that includes them it won't find the image. It will still show the same highlight on the second screen though. (On my system screen 0 highlights the second monitor, but I did try 1 as well)

from sikuli.Sikuli import *
#import os

myScriptPath = "D:\\ICProjects\\sikuli\\testML.sikuli"
if not myScriptPath in sys.path:
 sys.path.append(myScriptPath)

import testPOS
reload(sys.modules["testPOS"])

scrML = testPOS.initScreen(0)
testPOS.showSelectedScreen()
testPOS.ShowInfo()

Tags: fkt-region
RaiMan (raimund-hocke)
Changed in sikuli:
status: New → In Progress
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → x1.0
RaiMan (raimund-hocke)
tags: added: multimonitor
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Medium
RaiMan (raimund-hocke)
tags: added: fkt-region
removed: multimonitor
RaiMan (raimund-hocke)
Changed in sikuli:
milestone: x1.0 → x1.1
Revision history for this message
Pranav (pranav-avhad2009) wrote :

Hello RaiMan,

I want to highlight specific region from the image , I have written below code.
Its highlighting somewhere else and not the expected region from the image.

Please guide me in case of I have missed anything in below code.

public static Boolean isImageRegionPresent(String imageRegion) {

  String bigfilePath = Constants.configFolder + "Runtime.png";
  Finder f;
  Boolean result = false;
  try {
   f = new Finder(bigfilePath);

   f.find(new Pattern(imageRegion));

   if (f.hasNext()) {

    Match m = f.next();
    m.highlight(1);
    result = true;
   } else {
    Log.info("Expected Image region is NOT present.");
    result = false;

   }

  } catch (IOException e) {
   // TODO Auto-generated catch block

   result = false;
   e.printStackTrace();
  }

  return result;
 }

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.