← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #253748]: Region

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I cannot reproduce this behaviour with version 1.0.1.
works as expected.

pls. provide more info on your environment.

comments: 
--- window.setLocation(posicao)
... modifies the (x,y) top left corner of Region window (which in fact is a Match)

--- Region botao = window.setLocation(posicao)
... does not create a new Region object, but only a new reference to the Region object windows

to create a new Region object:
Region botao = Region.create(window.setLocation(posicao));

But one should not change window, so this is better:
Region botao = Region.create(window); // duplicate Region object
botao.setLocation(posicao);

I guess, that you want to finally click on a point relative to the found match.
For this we have targetOffset:
(simplified Java ;-)
pattern = new Pattern(some_image).targetOffset(xoff, yoff)
match = region.find(pattern)
screen.click(match)

the final click will not click on the centre of the match, but on the point calculated as:
Location(match.getCenter().x + xoff, match.getCenter().y + yoff)

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