← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #226009]: doubleClick() vs region.doubleClick()

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
unqualified calls like click(), doubleClick(), ... always have SCREEN as
region (a convenience for the IDE scripter - SCREEN is a "constant"
Screen object for Screen(0) (primary screen)).

If the used action includes an implicit search (click(some_image)) the
time consumed depends on the size of the region (SCREEN in this case).

As a general recommendation for speed, accuracy and robustness, one should restrict the search region as much as possible:
restricted_area.action(some_image)

If you give as parameter a Match, Region or Location object to an action
like click (as doubleClick(myRegion.getLastMatch()) in your case), the
qualifying region (SCREEN.doubleClick(myRegion.getLastMatch()) in your
case) does not matter (which is some conceptional oddity in the API).

BTW:
if myRegion.exists(myPattern,0: action(myRegion.getLastMatch())

is recommended anyway, since it avoids an unnecessary second search as with
if myRegion.exists(myPattern,0): action(myPattern)

The upcoming new version will have a shortcut for that:
if myRegion.exists(myPattern,0): myRegion.action()
action() without any parameter will act on the lastMatch of the qualifying region or on its center, if there is no lastMatch.

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