How do I make sikuli search only to the left of current mouse position?

Asked by April L on 2018-06-01

Hi. I have multiple images of the same symbol around a particular rectangle. I want sikuli to only search on it's left side for the next step. How can I proceed?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
April L
Last query:
Last reply:
arminius (arminius75) said : #1

I'm new at this, so make sure your backed up before you try it, but I managed to get a square region to go left of the mouse location, you should be able to swap out the mouse location for near the right of whatever images your looking for.
You can adjust the shape of the region easily by changing the Xis,Yis, Wis,His.

    ml = Env.getMouseLocation()
    Xis = ml.getX()
    new_Xis = Xis - 400
    Yis = ml.getY()
    new_Yis = Yis - 200
    Wis = 400
    His = 400
    Left_Region_of_mouse_location = Region(new_Xis,new_Yis,Wis,His)

masuo (masuo-ohara) said : #2

order to limit the scope of the search, set the Region where you want to search.
then use find feature.

use Env.getMouseLocation() to get the current location of the mouse cursor.
ml = Env.getMouseLocation()

use Region() to define region where you want to search.

rfull = Region(getBounds())
rleft = Region(0, 0, ml.getX(), rfull.getH())


masuo (masuo-ohara) said : #3

Sorry I was wrong, I forgot SCREEN.

rfull = Region(SCREEN.getBounds())

RaiMan (raimund-hocke) said : #4


rfull = Region(getBounds())

is ok and the same as
rfull = Region(SCREEN.getBounds())

because undotted methods are automatically bound to the SCREEN object.

April L (april96) said : #5

Thanks a lot everyone