← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #209152]: To find a image which is left of a image

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I would do it this way: (there are some typos I guess:         ...
=screen(0)         ...reenObject.Find(....


screenObject=Screen(0)

m = screenObject.exists("imgA")
if not m: exit(0)
x = m.left(50)

if x.exists("img B"): click(x.getLastmatch())
elif x.exists("img C"): click(x.getLastmatch())

since 
screenObject=Screen(0)
is not really needed:

m = exists("imgA")
if not m: exit(0)
x = m.left(50)
if x.exists("img B"): click(x.getLastmatch())
elif x.exists("img C"): click(x.getLastmatch())

I never work with try/except for FindFailed and these special  setFindFailedResponse() stuff.
It is somehow weird and makes the scripts messy.
exists() is the best we have ;-)

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