MarappPrashanth / sikuli-api

Automatically exported from code.google.com/p/sikuli-api
0 stars 0 forks source link

How to handle Target Offset in Sikuli Java API #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
My question is: How to handle Target Offset in Sikuli Java API (not Sikuli 
Script)

I am actually trying to click on the right most part of an image, but the 
target offset doesn't work. It just clicks on the center of the image instead.

I am trying to use the following code:

DesktopMouse mouse = new DesktopMouse();
ScreenRegion r;
mouse.click(r.getRelativeScreenLocation(121, 0));

Note: I got the target offset numbers from Sikuli IDE.

I would greatly appreciate your help. Thanks.

Original issue reported on code.google.com by lasyaku...@gmail.com on 17 Jan 2013 at 10:14

GoogleCodeExporter commented 8 years ago
You can use Relative to achieve the same effect as using target offset.
http://code.google.com/p/sikuli-api/wiki/Relative

For example,
ScreenLocation p = Relative.to(r).left(100).getScreenLocation();
mouse.click(p);

Original comment by doubles...@gmail.com on 17 Jan 2013 at 10:18

GoogleCodeExporter commented 8 years ago
Thank you for the reply. That worked perfectly, except that I had to use 
ScreenRegion instead of ScreenLocation. The example on this page was very 
helpful:
http://code.google.com/p/sikuli-api/wiki/ScreenRegion

Thanks again.

Original comment by lasyaku...@gmail.com on 21 Jan 2013 at 10:42

GoogleCodeExporter commented 8 years ago

Original comment by doubles...@gmail.com on 26 Feb 2013 at 7:43