← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #258197]: [1.1.0] Using observe to continuously look for pattern and take actions

 

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

RaiMan proposed the following answer:
With the implementation of the observe in 1.1.0 I decided to delegate
the observe control into the handler.

So an observe principally stops automatically with the first event occurring (where event is one specific on...).
If there are more than one events per observe, only the events that did not happen yet are observed until happening the first time.

This is especially useful for observing in background:
- you decide, wether you want to repeat the observation of the event by using repeat (which otherwise would not be observed any longer)
event.repeat() # simply keeps observing alive for this event after returning from the handler
event.repeat(secs) # does the same, but pauses the observation for this event for the given time in seconds after returning from the handler

This allows to adjust the scan rate for a specific event independently
from the overall ObserveScanRate.

There is an additional neat feature:
event.getCount()
tells you how often this event already happened during the running observe in background.
This gives you additional options to control the observe cycle.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.