New question #435811 on Sikuli:
https://answers.launchpad.net/sikuli/+question/435811

Hey guys, 

So I'm stuck with a small puzzle; Recently, I've decided to upgrade my test 
suites to SikuliX, from an older version of Sikuli from 4 years ago. The old 
click(x, y) method would find the image, and click x units right, and click y 
units down from the TOP LEFT of the image, where it is represented by (0, 0) 
coordinate. In SikuliX, offsetX and offsetY seem to be calculated with the 
SCREEN dimensions in mind. To avoid having to change every Click() in my test 
suites, I just want to change the customized click function I made, by 
converting the offSet calculations from relative to the screen, to relative to 
the image found. 

Here's an example of what I'm trying to do:

def Click(png,offsetX,offsetY, conf=0.70):
    #If pattern returns NO MATCH, return 0
    if exists(Pattern(png).similar(conf)) == None:
        print("Did not find " + png)
        return 0

    else:
        # Find returns a match object
        m = find(Pattern(png).similar(conf))
        
        # v1 = ???? Some calculation to use relative image x
        # v2 = ???? Some calculation to use relative image y
        
        print(str(m.getTarget().getX()) + " , " + str(m.getTarget().getY()))
    
        # Clicks with an @offsetX, and NEGATIVE offsetY, because we are using 
relative position to
        # x = 0, y = 0. Normally, it is returned as middle of the image
        click(Pattern(png).targetOffset(v1, v2))
        return 1

I'm just posting here before I start experimenting with numbers, I figured 
someone has had to have run into this before. I will close this if I find the 
solution myself, thanks!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to