← 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 exists(A, 3600) or exists(B, 3600) or exists(C, 3600):

will never work in your sense, since the or-condition is true if the first test from left to right is true.
hence if A exists, it does not matter, wether B and/or C exist.

another problem is the wait time: if A does not exist, it waits 3600
seconds for A and never tests for B and/or C during this period.

try this:

# the loop continuously checks very fast one after the other for A, B and C
# if none appeared, waits 1 second and repeats the search
# if at least one of A, B or C appeared end the loop
# isA, isB, isC carry the information about each appearence
while true:
    isA = exists(A, 0)
    isB = exists(B, 0)
    isC = exists(C, 0)
    if isA or isB or isC: break
    wait(1)
# now make your complex decisions:
if isA and not isB and not isC:
    # do something if ONLY A was visible
if isA and isB:
    # do something if A AND B was visible, C does not matter
.... hope you got it ;-)

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