← Back to team overview

sikuli-driver team mailing list archive

[Question #692500]: Pass Location() as a parameter in definition

 

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

I created the following definition to calculate new click location when a windowed application is moved around. 

app = App("someapp")

def clickloc(X, Y):
    app.focus()
    appregion = Region(App.focusedWindow())
    appregionx = appregion.getX()
    appregiony = appregion.getY()
    click(Location(appregionx+X,appregiony+Y))

clickloc(1194, 109)

I would like to just use clickloc(Location(1194, 109)) because it's a lot easier to just use the IDE's Location button after typing clickloc. 

How would I go about that? Wasn't sure how to pass location object as a parameter. 

Also, is there a better method than doing app.focus() then the Region(App.focusedWindow())? 

Tried the following but gave wrong coords.

 appregion = App("someapp").focusedWindow()

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