sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04635
Re: [Question #168160]: Giving me an error in a if
Question #168160 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/168160
Status: Open => Needs information
RaiMan requested more information:
what kind of error? hard to guess ;-)
one thing:
t1 = Match(thex, im.getY() + 35, im.getW(), im.getH(), 1)
click(t1)
A Match should not be created by hand (it is returned by a find). A
Match is a rectangular object and inherits from Region.
so you should do this, to get a "handmade" Region object:
t1 = Region(thex, im.getY() + 35, im.getW(), im.getH())
But in this case this is not needed:
Since a click on a Region clicks on the center and you are placing the region to click 35 pixels downwards, the easiest possibility (among many others ;-)
if im:
click(im.getCenter().below(35))
else:
....
One more thing:
if find():
does not make sense, since if not found the script will stop with a
FindFailed error.
In these cases you have to use exists()
if exists("some-image.png"):
click(getLastMatch()) # would click the found image
else:
print "not found"; exit(1)
To learn about the used features: http://sikuli.org/docx/
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.