sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29846
Re: [Question #259693]: Clicking on multiple appearing images for a specific time
Question #259693 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/259693
Status: Open => Answered
RaiMan proposed the following answer:
Sounds like some online game, that you want to bot ;-)
For someone without programming/scripting experience this is a challenge
;-)
... and it is a timing problem, since the searches normally are not done
in parallel. So checking 5 images for existence one after the other
might take too long, but this depends on the size of the search region
(the smaller, the faster).
a basic approach:
end = time.time() + 30 # the duration of one cycle (timeline as you say)
reg = <define the region, where the images appear>
img1 = <shot of image 1>
img2 = <shot of image 2>
img3 = <shot of image 3>
img4 = <shot of image 4>
img5 = <shot of image 5>
while time.time() < end: # loop until 30 seconds have elapsed
if reg.exists(img1, 0): # look for the image and come back immediately if not found
click(reg.getLastMatch()) # click it if found
if reg.exists(img2, 0):
click(reg.getLastMatch())
if reg.exists(img3, 0):
click(reg.getLastMatch())
if reg.exists(img4, 0):
click(reg.getLastMatch())
if reg.exists(img5, 0):
click(reg.getLastMatch())
# at this point we start again with the 1st image
mind the leading blanks (Python indentation)
come back in any case
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.