← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #165356]: else if

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
That is tricky with Sikuli, since each exists() makes a find operation
that lasts 3 seconds if not found.

So if you want to check "concurrently" for more than one image, you have
to use observe() (rather complex) or a loop with exists(img,0) (searches
only one time) which I usually prefer.

i1 = i2 = i3 = False
while True:
   if exists(img1, 0): i1 = True
   if exists(img2, 0): i2 = True
   if exists(img3, 0): i3 = True
   if i1 or i2 or i3: break
   wait(1)
# now you can make your decisions based on i1, i2 and i3

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