← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #199842]: What is the most efficient way to wait for an image to appear or vanish?

 

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

Dale R Mcgeachie requested more information:
Hi thx for quick reply, this is my code -

switchApp("Myapp")
while not exists("desktop", ): # myapp is windowed, full screen, hiding desktop, therefore always loop
setThrowException(False) # get rid of not found errors
type("mykey") # this triggers random appearance of icon
sleep(13) # workaround to wait for icon changing to second state - icon_1st_state appears randomly and then changes after a random amount of time between 1 - 15 seconds
Region(Region(myregion)).inside().rightClick(Pattern("icon_1st_state").similar(0.47).targetOffset(-11,9)) # click it
hover("mouseoutofway") # move mouse to a corner of screen - icon somtimes appeared under mouse

I need to be able to rightclick the icon exactly when it changes to its
second state, and I need the program to run constantly, as it is it
works, but it would be better if caught the change to the icons second
state. I was thinking of using lastmatch and setting the search region
to where the icon is found and using onchange? to detect the change to
the icons second state. thx :)

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