← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #656216]: How to set observe() to run in background forever?

 

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

    Status: Open => Answered

Manfred Hampl proposed the following answer:
see
http://sikulix-2014.readthedocs.io/en/latest/region.html#Region.observeInBackground

"The observation is run in the background, meaning that the observation will be run in a subthread and processing of your script is continued immediately.
Take care, that your script continues with some time consuming stuff."

You need something what the script is doing in the foreground while the
observeinbackground is waiting for the image to appear. Otherwise the
script immediately continues, and terminates because there is nothing to
do.

Actions to keep the foreground "busy" are e.g. sleep(seconds) or
wait(,seconds) or a pop-up window as suggested by masuo, or otzher
actions like searching and/or clicking on images etc. etc.

If you do not have anything to do in foreground, but just want to wait
for the image to appear, you probably better use wait(img1,FOREVER)
instead of observerinbackground().

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.