← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #252905]: i want sikuli to select options closest to the mouse pointer location when there are more then one matches present

 

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

    Status: Open => Answered

Eugene S proposed the following answer:
Hi,

There are a couple of options I can think about in regards to how to
find specific object from multiple similar matches however it depends on
how exactly these objects are distributed on the screen and if there are
any "anchors" that can be used.

Answering your question directly, there is that option:

1. Use loc = Env.getMouseLocation() to get the mouse location.

2. Create region based on that location:
    reg = Region(loc.getX(), loc.getY(), 1, 1)

3. Try to extend the region, as described here: 
     http://doc.sikuli.org/region.html#extending-a-region
     until you cover the area you are interested in.

4. Use highlight(seconds) method to better understand where your region
is exactly.

For example:

loc = Env.getMouseLocation()
reg = Region(loc.getX(), loc.getY(), 1, 1).nearby(20).highlight(1)

This will give you a frame around your mouse that might cover one of
your patterns.

Please try that and update if you still facing issues.


Cheers,
Eugene

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