Here's what I tried:
Screen screenWithCalendarField = new Screen();
Match calendar = new Match();
try{
calendar = screenWithCalendarField.find(new File("D:\\Sikuli\\CalendarField.png").getAbsolutePath());
}
catch(Exception e){
}
calendar.hover();
delay(5)
calendar.mouseMove(25, 0)
delay(10)
calendar.click();
The mouse moves as expected (25 pixels right from the match), but then it moves back and the click is still performed at the location of the match.
What should I use to have the click done 25 pixels right from the match?
This is RaiMan from SikuliX.
since
calendaris a Match, aclick()will always click at the location, that is currently stored with the match (the center in your case).mouseMove()only moves the mouse, but does not change the stored location in the match.To click at the current mouse position instead of
calendar.click()usescreenWithCalendarField.click(Mouse.at()). You might as well usecalendar.click(Mouse.at()), but using the Screen class is clearer, since the current mouse position is in the coordinates of the screen anyway.If the offset you want to click at is known from the beginning, you should use the Pattern class to define an object to search, since it allows to set an offset with the image to search for.
So this would be my version (simplified to show the basics):
Hope it helps.