sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #41362
Re: [Question #446476]: Need a good examples of Region, Match, Offset, Finder,
Question #446476 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/446476
Vadivelan proposed the following answer:
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
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.