i want to get the correct location(x,y) of the image i clicked.
i want solve this problem: i want to judge whether image A is on the left of image B? My idea is get the x1 of image A and x2 of image B,if x1<x2,then image A is on the left of image B. but it seems that SikuliLibrary not provide related keywords? so do you have any suggestions?
Could you describe why you need such kind of keyword? From the title, you want to return location when use "click" keyword, right?
NO, the "click" keyword is perfect yet! A few years ago,i use sikuli+jython+robotremoteserver to do automation, there is a "Get_object_Center_XCoordinate" keyword, which i can get the image center location(x), but your SikuliLibrary not provides the keyword. In fact,when i click a image,there is log "[log] CLICK on L(191,864)@S(0)[0,0 1920x1080] (520 msec)",i just want to get "L(191.864)" this value,so i hope SikuliLibrary can provides the keyword. do you think?
i don't want to click the target image or anything, i just want to distinguish the image and get the (x,y), then i can compare the location of two images, then i can judge whether the page layout is right.
if you want to know, where the image is, you first have to do a find, which returns the Match with the coordinates you want. Uuuuups, just looked through the keywords: nothing there, that returns a Match.
i am sorry that i didn't find a keyword which return the Match with coordinates,in fact,they return True/False commonly... ...
@chuanyuny I think: no need to be sorry. Such keywords simply seem to not exist at all.
You either make your own or ask @rainmanwy to either add a feature, that allows to access the match of the last find operation or a find keyword.
@RaiMan thank you. Actually, there is a "mouse get pos x/mouse get pos y " in autoitlibrary, the keywords are quite effective. i am just give @rainmanwy a advice.
@chuanyuny @rainmanwy
in SikuliX this is done with Mouse.at() which returns a Location object giving the current position of the mouse pointer. But in your case you would need to at least have to hover (move the mouse) to the image (default is center). A click might change your GUI situation. With a find operation only you could simply check the actual Match object being the region of the found image on the screen. After that you might proceed with whatever you want by acting on the Match object.
Thanks @RaiMan and @chuanyuny , i may add a keyword to get the location of image. Whether it is enough for you @chuanyuny ?
"click" series keywords could be updated to return location also, but i am not sure whether it is needed.
Now,"click" series keywords are good enough,no need to update anymore.i think,you add new keywords is ok,like "Get_object_Center_XCoordinate(image,timeout)/Get_object_Center_YCoordinate(image,timeout)". Thank you!