← Back to team overview

sikuli-driver team mailing list archive

[Bug 604514] Re: Observe() not working on Windows

 

""""a temporary solution, if you want to wait for changes in a region:

theRegion = the-region-to-observe
img = capture(theRegion)
for i in range(10):
   if not theRegion.exists(img,0): break
   wait(1)""""

But this stops your script, and avoids it to do other things during this
search.

The good thing about observe it's to run it in background. At least for
me

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

Title:
  Observe() not working on Windows

Status in Sikuli:
  Fix Committed

Bug description:
  Win7-32, 0.10.1

onAppear(any-visible-image); observe()
the observation loops infinite, though the image gets visible and would be matched by a find()

onVanish(any-visible-image); observe()
the observation loop finishes at once, though the image is still visible

the test script:

def myH(e):
   popup("Hello")
   stopObserver()

imgObs =
if not exists(imgObs, 0):
 onAppear(imgObs, myH)
else:
 onVanish(imgObs, myH)

popup("Start")
observe()
popup("End")

the script behavior is controlled, by either hide or unhide the image before it is run and then unhide/hide it respectively, by dragging around a window on the desktop.

All this works perfectly on Mac 10.6