Jump to content

How can I find "WindowPosition" coordinates?


Recommended Posts

Hey again guys

Im a big noob to Autoit. I think its a basic question but I cant really find an answer to it. Im trying to use WindowPosition like:

$WindowPosition = WinGetPos("")

MouseClick ("left", $WindowPosition[0] + 250, $WindowPosition[1] + 40)

However Im having trouble figuring out how to find right coordinates inside a window. Are here any programs that can help me find coordinates in side specific windows? I dont think Autoit v3 Windows Info does it. Its just finds coordinates on the screen not in window coordinates.

Please help. Sorry for bad English, tried hard to not being confusing

Edited by nusaki

keywen.com

Link to comment
Share on other sites

You need to pull up your Autoit window info tool and click on the Control tab and when you are in your window you need to get the coordinates at the place where your mouse is at. So hover your mouse over the area that you want to click and the do ctrl+alt+f. Freeze pane. Then go back to your code and do something like this:

CODE
Run("notepad")

$kung = ControlGetHandle("Untitled - Notepad","","[CLASS:Edit; INSTANCE:1]")

WinActivate("Untitled - Notepad","")

Sleep(1000)

Controlclick("Untitled - Notepad","",$kung,"right",1,86,31)

Link to comment
Share on other sites

Im having so many problems with Autoit Window info.

Pixel detection is killing me.

1st problem when I ctrl+click and then freeze by ctrl+alt+f my mouse position = 254, 549 and my ControlClick Coords: 231, 260. What should I trust when I do pixel detection, and why are they different, my Window position is (0, 0).

2nd When I use WindowPosition, for example:

MouseClick ("left", $WindowPosition[0] + 469, $WindowPosition[0] + 552)

As I move my window around mouse clicks in a different spots, is that normal?

3rd For my Full Tilt Poker boot Im trying to find 8 player tables but mine bot can never find pixel that defines #8 because no matter what coordinates I use from Window Info are wrong ones. Mine Window info is now set to Coord Mode = Window

Is Autoit not too precise or Im an idiot noob or is my computer is messed up?

I got win xp pro if that helps anyhow

Please help Im ripping my hair out

keywen.com

Link to comment
Share on other sites

I'm having so many problems with Autoit Window info.

Pixel detection is killing me.

1st problem when I ctrl+click and then freeze by ctrl+alt+f my mouse position = 254, 549 and my ControlClick Coords: 231, 260. What should I trust when I do pixel detection, and why are they different, my Window position is (0, 0).

2nd When I use WindowPosition, for example:

MouseClick ("left", $WindowPosition[0] + 469, $WindowPosition[0] + 552)

As I move my window around mouse clicks in a different spots, is that normal?

3rd For my Full Tilt Poker boot I'm trying to find 8 player tables but mine bot can never find pixel that defines #8 because no matter what coordinates I use from Window Info are wrong ones. Mine Window info is now set to Coord Mode = Window

Is Autoit not too precise or I'm an idiot noob or is my computer is messed up?

I got win xp pro if that helps anyhow

Please help I'm ripping my hair out

In the AutoItInf tool the mouse coordinates are for the whole screen but the control click coordinates are for the client area of the active window. Top left of the client area if 0,0 but if the window is at 100,200 then the screen coords for the top left of the client area are 100+border width, 200+borderwith + Captionheight. (Ignoring any menu bars etc which push the client area down.)

These conversions are done for you with

Function _WinAPI_ScreenToClient_WinAPI_ScreenToClient

andFunction _WinAPI_ClientToScreen

_WinAPI_ClientToScreen

You can also change the coordinate system for mouse functions with

AutoItSetOption("MouseCoordMode",....);see help

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks for all your help. Im very comfortable with using Window Info now. There is just one problem thought. When Im using in window coordinates (WinGetPos("")) and ctrl+click. It doesnt work very well. As I move window around clicks lose its accuracy it doesnt click in exact pixel it clicked before window was moved and if I move window from one side of a screen to another it may even miss a button by a little bit. Do you know what that happens and is here way to fix that by adding some constant or something :D

keywen.com

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...