← Back to team overview

sikuli-driver team mailing list archive

[Bug 966536] Re: Sikuli can't find a match on a second screen/monitor when calling a function in an included module

 

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;
	}

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/966536

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

Status in Sikuli:
  In Progress

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()

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/966536/+subscriptions


References