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?

 

Example:

image.png.313a79c154de5b468957f7c27108a66c.png

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:

https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_ScreenToClient.htm

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

image.png.2f83bdbe9f857c0f7d2a3bb1268c9e47.png

 

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?

WinPos?

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:

Spoiler

image.thumb.png.5b3e309164e289fbdd613629af93c1f6.png

Spoiler

image.thumb.png.cba3f0ebe82847fed1d8f0bf49398084.png

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

 

image.png.dd78a2be65ad363327bf8115bd525fd4.png

 

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:

image.thumb.png.f312df077558d112ceb742b3ca50b946.png

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
 Share

  • Recently Browsing   0 members

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