← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #209147]: if exists with try catch

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
When you are using Sikuli features, then you should rely on its basic image handling features.
Might be of some value, to read across the docs at least once ;-)

if exists(Pattern("file.png').similar(0.95)):
    getLastMatch().highlight(3)
    click(getLastMatch())
else:
    exit(1)

again: the Sikuli like solution is:

if exists(Pattern("file.png').similar(0.95)):
    click(getLastMatch())
else:
   click(imgB)

and run this in slow motion, so your click points are made visually

BTW: to adjust similarity of an image in the IDE:
click on the image thumbnail to get the Preview window, where you can adjust some aspects of a captured image.

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