Question #232031 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/232031
Status: Open => Answered
RaiMan proposed the following answer:
... nearly perfect ;-)
while 1:
if exists(end_condition, 0): # comes back after one try
break
if exists(action_available, 0):
doubleClick(getLastMatch()) # no additional search
sleep(5)
-- # comes back after one try
normally all explicit or implicit search operations wait the standard waiting
time (3 seconds) for the target to appear.
Setting the second parameter of exists() to 0, let it come back immediately
after the first search. With restricted search regions, you might be able to
perform up to 10 exists(ing,0) per second.
-- # no additional search
especially after having used exists() or wait() and they succeed, the search
region (the SCREEN in your case) still knows the last successful match, that
can be recalled by using getLastMatch(), so your doubleClick(getLastMatch())
now happens instantly after a successful exists() and not after up to one
second as with doubleClick(action_available), that searches again, what was
already found before.
the snippet with version 1.0.0:
while 1:
if exists(end_condition, 0):
break
if exists(action_available, 0):
doubleClick() # clicks the last match
sleep(5)
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp