Need a good examples of Region, Match, Offset, Finder,

Asked by Chenna

am brand new to Sikuli and using Java with Sikuli. As I donot see very good examples and not able to understand with the found one, posting it here:

what is Region, Purpose of Region, How to capture coordinates, etc...

similarly Offset, and its purpose

Finder and its purpose. Difference between Finder, Offset, Region, etc.

Please provide good explanation and request you not to give generic url that contains hundreds of pages.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Nevertheless ...

... you have to at least read across the docs, to understand the main features:
http://sikulix-2014.readthedocs.io/en/latest/index.html

... then you should use the latest version 1.1.1 (http://sikulix.com
(be aware: https://github.com/RaiMan/SikuliX-2014/wiki/Usage-in-Java-programming)

... and as an experienced Java programmer you might find javadocs helpful:
http://nightly.sikuli.de/docs/index.html

Revision history for this message
Vadivelan (velan) said :
#2

What is Region:
Region is nothing but a certain area of our interest. It has a starting co-ordinate (x,y), width and height. In Sikuli, this is always rectangle / square.

Use of Region:
If I ask you to find the word "TO" In "Welcome TO sikuli", your answer will be it is in 9th position. Likewise, in a windows desktop screen-shot, if I ask you to find the windows start button image, you will say it starts from x,y location and have this width & height (because it is two dimension search). Once we find that region, we shall let sikuli to click on it or whatever we want to accomplish. Like this we can automate games, auto fill forms and many more.

If sikuli is a text search tool, it will work based on index/pos. Because this is image search mechanism, it will return region ( or match / rectangle ... everything is same more or less ) and we can do operation on that region.

How to capture co-ordinates:
Sikuli IDE lets you capture image from your windows / screen.
You can create regions in multiple ways..
for eg:
Region(x,y,w,h) - by giving coordinates
SelectRegion() - upon running the script have to select a region through mouse
find(img) - image img will be search on the screen and will result a match ( region )
there are many more ways...

Purpose of Offset:
Lets say you want to fill a html form automatically through Sikuli. Just asking sikuli to click on the textbox image won't workout because there will be many text boxes. So generally, we used to find the label nearby that textbox, gets it's coordinate and then instruct sikuli to click (x,y) away from that region.. so that it will click on the intended text box.
eg:
find("label-name.jpg").offset(x,y)
click()
type("my name")
( just for example.. it can be achieved more easily & efficiently )

Finder:
This is how you find a Region of your interest. Or this is one another way to create a Region.
Ie.. find the yellow color balloon in the screen, find the firefox icon image in desktop, get the region and double click on the region etc.

If you want to easily understand the Sikuli documentation, if you first read the Region chapter and simultaneously refer other topics whenever you encounter ( like Screen, find / finder, match etc ).
Start here: https://sikulix-2014.readthedocs.io/en/latest/region.html

Can you help with this problem?

Provide an answer of your own, or ask Chenna for more information if necessary.

To post a message you must log in.