sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #02087
Re: [Question #151368]: What does this runtime error?
Question #151368 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/151368
Status: Open => Answered
RaiMan proposed the following answer:
--1.
match1 = find(region.png)
click(getLastMatch.find(imageinsideregion.png))
getLastMatch is a function call and has to be: getLastMatch()
so:
match1 = find(region.png)
click(getLastMatch().find(imageinsideregion.png))
should work (I suppose, the apostrophes with the image file names are
only missing here, not in your script)
-2.
All things are transient (get obsolete) at the end of processing any click, find, hover, or whatever. they are only preserved if you save them in variables for later use - so it is your decision.
an exception is getLastMatch(), which recalls the last match of a region, that is stored by any find operation.
in this sense:
click("image1.png") # does not remember anything
match = getLastMatch() # you use this, because you decide to remember the region, that image1.png occupies
# just leave it, if you do not need it
If you do not specify a region, the default region SCREEN is used, that
usually is the primary screen or Screen(0).
so
find(some-image)
and
SCREEN.find(some-image)
and
Screen(0).find(some-image)
are aquivalent.
--- 3. you ask
When was the match declared and related to an area?
a match is "declared" by a find operation and saved as LastMatch (use
getLastMatch() to get it) in the region that was searched. a match is
not related to an area, it IS an area itself, like a Region, only with
some more information (e.g. a dedicated click point).
use
print Region(SCREEN) # it is a Region
print find("region.png") # which is a match
and you can see it.
--4. you ask
I would like to kind of hover over an area, ....
ok, just do it:
match = find("region.png")
hover(match)
wait(3) # so you can see the mouse hovering
click(match.find("the-image-to-click.png")
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.