← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #184410]: Sikuli + Regex = Sikex

 

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

Josh posted a new comment:
Another design pattern that I am using that I find really useful is
storing matching logic in the PNG files themselves in an extra data
block.

That way if there is an image that you want to be matched with a higher
similarity you can encode that into the image itself and have your
"sikuli script" less cluttered.  Additionally this logic can be shared
by multiple scripts that use the same image without adding additional
code to each.

Other things you can do is if you are matching a sequence of images, say
for instance you are looking for 3 corners of an application window.
This is how something this could play out:

Region1-Image1 (Top-left corner eg. application icon)
Context-Previous: None - Applied to the previous region = null
Context-Current: Similar(1.0) - Applied to the pattern that is used for find()
Context-Next: RegionRight() - Applied to the region that is returned for image2

...returns region on match for image2..

Region1-Image2 (Top-right corner eg. maximize, minimize, close)
Context-Previous: RegionNearby(10) - Applied to image1 region (give some lead-way for this match)  
Context-Current: None - Apply to this pattern match
Context-Next: RegonBelow() - Apply to region passed to image3

Region1-Image3 (Bottom-right corner eg, bottom border)
Context-Previous: RegionNearby(10)
Context-Current: Similar(1.0)
Context-Current: None

-- After all 3 corners are matched find the min/max x/y coordinates to
find the window size.  This allows you to find resizeable windows more
robustly that doing a large image match.

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