Jump to content

Convert window pos to screen pos

Recommended Posts

I'm using a third party app to search for image on my screen, when image found it give me the pos XY relative to my screen.

 Is possible convert a XY position relative to screen to a XY pos of handle control?




Using au3 info the pos of the word "Autoit" is 542,307 (2)

Searching the "Autoit" word relative to my screen is 677,384 (1)


What im trying achieve is convert the pos (1) to pos (2) and use in the controlclick function:

$X = pos converted from 677 to 542

ControlClick("", "", "", "left", 1, $X, $Y)


I found this function to convert screen to client, but it convert only the window relative pos, to a control pos:


Using this function it will convert pos 542, 307 (found on au3 info window) to a controlclick pos (538,313)



So i would like ask if there's any function to do the same above, but converting screen to control.

Edited by memerim
Link to comment
Share on other sites

WinPos will give the position of the window. By removing the X and Y position you will get the control position.  Also take a look at Opt ("PixelCoordMode", 0), might work with your image search...

Link to comment
Share on other sites

"I'm using a third party app to search for image on my screen" how pixelcoordmode could help?


And i cant remove the X and Y position from the control.



Why au3 info gives wrong result as my screen is 1920x1080 it display 1535 822, look at windowspy from another program, 1920x1080

Theres a weird white small box with wrong size, when i try select my desktop screen:





I've already tried change all options in coord mode, and it always display my screen as 1535




Edited by memerim
Link to comment
Share on other sites

I found the problem, if someone suffer with same, to resolve it:

Go to autoit folder and change DPI option in auto window info and autoit exe:


Now my autoit info display correct position and size of things.



-EDIT- Problem solved, as the autoit can click correct position now, i can use the function i post before and convert screen to client pos.

Edited by memerim
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...