sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #28099
Re: [Question #254155]: getLastMatch expected 1 args?!
Question #254155 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/254155
Status: Open => Answered
RaiMan proposed the following answer:
all documented Region functions are object methods and hence have to be
used with a Region OBJECT and not with the Region CLASS (as you did with
Region. )
The respective region is the region, where the respective search was done.
If you did an undotted search (something like exists(some_image) then the respective region is the whole screen, that automagically behind the scenes leads to SCREEN.exists(some_image). Where SCREEN is a "constant" region object created as Screen(0).
hence in your case:
if exists(some_button):
click(getLastMatch())
or with a specified region
reg = <some evaluated region>
if reg.exists(some_button):
click(reg.getLastMatch())
since 1.0.1 there is a convenience available (not yet documented):
if exists(some_button):
click()
or with a specified region
reg = <some evaluated region>
if reg.exists(some_button):
reg.click()
a click or similar functions without parameters will click the last
match of that region or the center if no match exists yet.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.