How to calculate the exact center of a computer screen?

Asked by arminius on 2017-06-12

I have a process that drags and drops very close to my intended location, but not close enough.
I need to drag and drop from "the center" as it is on the monitor, to the location pinpointed on the screenshot.
So we move from the wrong location left right up or down to the correct location.
Hope I articulated that right.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
arminius
Solved:
2017-06-14
Last query:
2017-06-14
Last reply:
2017-06-12
masuo (masuo-ohara) said : #1

[How to move mouse the center of the screen]
mouseMove(SCREEN.getCenter()) or mouseMove(Screen(0).getCenter())

[How to check the value]
print SCREEN.getCenter() #Location
print Screen(0).getCenter()
print SCREEN.getCenter().getX() #Coordinate X
print SCREEN.getCenter().getY() #Coordinate Y

[about getCenter() and Screen]
http://sikulix-2014.readthedocs.io/en/latest/region.html?highlight=getcenter#Region.getCenter
http://sikulix-2014.readthedocs.io/en/latest/screen.html?highlight=SCREEN

arminius (arminius75) said : #3

Sorry, my bad, that worked great.