sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #14414
Re: [Question #213447]: clicking one of the images on list
Question #213447 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/213447
Status: Open => Answered
RaiMan proposed the following answer:
if I understand right:
while True:
if exists("image1.png", 0):
click(getLastMatch())
continue
if exists("image2.png", 0):
click(getLastMatch())
continue
if exists("image3.png", 0):
click(getLastMatch())
continue
wait(1)
This will look for each image once per loop turn (each search between 0.5 and 1 second).
If none of the images was found, it will wait 1 second (might be adjusted).
If an image was found, it is clicked and the loop starts all over again (means: image1 is always clicked if found, even if image 2 or 3 are there - come back if this kind of priority sequence is not your intention)
Depending on your scenario it might make sense, to wait a little after
the click, hence:
while True:
if exists("image1.png", 0):
click(getLastMatch())
wait(1)
continue
if exists("image2.png", 0):
click(getLastMatch())
wait(1)
continue
if exists("image3.png", 0):
click(getLastMatch())
wait(1)
continue
wait(1)
The related FAQ's:
faq 1800 indentation
faq 1437 loop
faq 1501 use of exists()
happy scripting ;-)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.