← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #190146]: Is there a way to check for a particular pop-up in the background throughout the script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
def Action(event): # a function definition: def name(parameter, parameter, ...)
      event.region.click("image-of-ok-button.png") # this searches the ok-button in side the observed region

SearchRegion = (10,20,30,40) # some region
SearchRegion.OnAppear("errorimg.png" , Action) # The handler to click OK
SearchRegion.observe(FOREVER, background = True)

while exists("xyz.png"):
      (do a set of operations)
while exists("abc.png"):
      (do a set of operations)
.... # the script will continue for other workflow.

Image file names have to be quoted.

For more information on background, options and available attributes see: 
http://sikuli.org/docx/region.html#observing-visual-events-in-a-region

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