← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Here's the structure of the script:

def MainFunction():
    #1. initialize program
    #2. call a bunch of functions to do various things within a infinite loop

def Disconnected():
    #This function closes disconnect message and attempts to continue from #2 above

def IdleObserver():
    regionDisconnect.onAppear(disconnectPattern, Disconnected)
    observe(FOREVER,background=True)

Goal is to detect any disconnect, call a function (e.g. Disconnected()) to remedy the situation, resume from #2 in MainFunction() and resume observing for disconnects.

Where/how do I call this IdleObserver() function so that when disconnectPattern is detected, it calls Disconnected() and then goes back to observing for disconnectPattern? Is there a better way to accomplish the same goal?

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