← Back to team overview

sikuli-driver team mailing list archive

[Bug 1078806] Re: not exists doesn't do anything

 

Thank you! It works well now.

If I have all other windows closed and a simple background I would think
it would take longer to execute, but not necessarily throw a false
positive. Why is it that false positives are returned if you search the
whole screen?

How are matches found in Sikuli?

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

Title:
  not exists doesn't do anything

Status in Sikuli:
  New

Bug description:
  I am using a patched version of Sikuli X 1.0rc Maltipoo on 32-bit
  Windows XP.

  Here is the offending code:

  i = 0
  if(not exists("HEWLETTPACKA.png")):
      click("1352827765773.png")
      while (i < 10):
          type(Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN 
               + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN 
               + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN 
               + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN 
               + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN 
               + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN + Key.DOWN)
          if(exists("HEWLETTPACKA-1.png")):
              break
          i = i + 1

  doubleClick("HEWLETTPACKA-1.png")

  Basically, I'm trying to check for the existence of an HP order in a
  list of orders that need to be filled.  If it doesn't exist, click the
  beginning of the list and scroll down until a new page of orders is on
  the screen and search again. If it appears on the screen, break out
  and double click the order to open it.

  For some reason when the script is running the if not
  exists("HEWLETTPACKA.png")): is either evaluating to it's opposite or
  not being evaluated at all. But then when I get to the double click it
  can't find the HP order because it doesn't exist! The exact same code
  was working just fine yesterday, which is really weird.

  I looked at the matching preview and fiddled with similarity but that
  didn't help. The preview says it's finding the matches it should be
  finding. I also tried saving the value returned from exists outside of
  the if statement and comparing it to None but that didn't work either.

  I do notice that when I comment the line out, the HP image and
  following parenthesis and colon aren't greyed out. I tried retyping
  the line and taking a new screenshot but it didn't help the commenting
  or the failing code.

  I put it in a try: Except FindFailed: statement and it seems that when
  I try to find "HEWLETTPACKA.png" it doesn't actually throw an
  exception or go into the code within the except statement. However,
  when I try to doubleClick the image after the except code block, it
  does throw the exception. When I run the code block from the except
  statement by itself it works great and scrolls until it finds an HP
  order with no issues.

  Here's the offending try/except code:

  i = 0
  try:
      find("HEWLETTPACKA.png")
  except FindFailed:
      click("1352827765773.png")
          #... same as before...

  doubleClick("HEWLETTPACKA-1.png")

  Breakpoints in the sikuli IDE would make my life, guys. :) I have no
  idea what's going on here.

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


References