← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #640445]: Scan for either of the 3 images during runtime

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
if I understand your intention right and the indentation, then this
script should never end:

# this loop will run forever, see comment
while True:
      if exists(A, 0) or exists(B, 0) or exists(C, 0):
          click(X)
          click(Y)
          click(Z)
          sleep(2)

else: # this does not make sense, since it refers to the while, which is always true
     sleep(1)

comment: it would only stop, if one of the click(...) produce a
FindFailed exception

so this should do what you want (supposing the click(...) have images as targets):
while True:
      if exists(A, 0) or exists(B, 0) or exists(C, 0):
          try:
              click(X)
              click(Y)
              click(Z)
          except: pass
          sleep(2)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.