← Back to team overview

sikuli-driver team mailing list archive

[Question #190541]: Observer running in the background, closing dialogs on popup

 

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

I'm trying to create a script that will close certain windows/dialogs on popup - it i important that it runs in the background and closes the popups asap.

If I understand correctly, I can use the onAppear with observe set to infinite and background set to true.

My problem here is that I'd like to build a library of images that the onAppear handler would act on, so:

a =image1, image2, image3, image4 

def myHandler(event):
	wait(cross)
        click(getLastMatch)
	print "it happened"

onAppear(a, myHandler)
observe(FOREVER, background = True)

1. Am I checking the library correctly? 

2. How to make sure that the main script will not terminate/continue before the handler finishes closing the dialogs?  For example:
while True:
   freeze the main script
   run the handler
   resume the script
 
3. Currently my script finds the main script image faster than the image from the library, thus not allowing the handler to close the dialog. I am unable to create a region for the library "a", because they all appear in different spots on the screen.
Is there any way to create  a specific region for each of the images or something like that?


Thats a lot of questions, hopefully someone can help me :)!

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