← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #200170]: exists() in or-case in java

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
expressions like x or y are evaluated left to right.

since the first exists() waits 40 seconds if 34 does not appear, this is
obvious.

So you have to do something like this (forgive me if it is not correct
Java syntax):

waittime = 40

while wait time > 0 {
     Match m34 = screen.exists("fotos/34.png",0)
     Match m35 = screen.exists("fotos/35.png",0)
     if not m34 and not m35 {
           waittime = waittime -1
           wait( (double) 1.0)
           continue}
     screen.click(m34)
     screen.click(m35)
}

This works in your sense, since we are using exists(image,0), which
returns in any case after one search try and we are putting the wait int
a counting loop.


     screen.click(m34)
     screen.click(m35)
works if always only one of them is visible (click(null) does just nothing ;-) - and is the same as yours

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