← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #191510]: Problem in if else

 

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

    Status: Open => Answered

Jacob Dorman proposed the following answer:
The similarity for the patterns you're using probably isn't high enough.
Similarity is how "picky" Sikuli is when looking for your particular
image.  If the similarity is too low, you risk clicking thing you don't
want to.  If it is too high (usually around 100% similarity), you risk
Sikuli not being able to find the thing you're looking for.

 If you're going to be reusing the same images I find it is helpful to
define the patterns first, then use the variable name to reuse them.

follow = (take screen capture here, click the image and set the similarity that you want)
circles = (take screen capture here, click the image and set the similarity that you want)
exit =  (take screen capture here, click the image and set the similarity that you want)

Then you can use the variable names inside of RaiMan's code:

if exists(follow, 0): click(getLastMatch())
elif exists(circles, 0): click(getLastMatch())
else click(exit)

You could go through and change the similarity to every image in your
code, and have many duplicate images, but if you declare the patterns
with variables before hand, you can change them all at once (the image
or the similarity).  Happy coding :)

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