Reputation: 9244
I'm trying to get the position of a window, so I can write a script to double click to that window. Is there any ways to do this in AutoHotkey?
Upvotes: 2
Views: 1807
Reputation: 1343
The question has autohotkey tag, so I assume it's about AutoHotkey, right?
If yes, all you need is WinGetPos command, allowing you to get x,y
coordinates of the upper left corner of the window.
WinGetPos [, X, Y, Width, Height, WinTitle, WinText, ExcludeTitle, ExcludeText]
First four parameters are the names of variables, that will get info about the window. Last four parameters are standard for almost all AutoHotkey Win-commands, they identify the window.
Simple example:
SetTitleMatchMode 2 ;# match window title in any place
IfWinExist, Notepad
WinGetPos, Xpos, Ypos ;# Uses the window found above.
This will put the Notepad window position into Xpos
, Ypos
variables.
Then you can use those Xpos
, Ypos
variables with Click command to send the click.
Upvotes: 2
Reputation: 29065
You might be better off getting a handle to the window and using SendMessage()
(or whatever the equivalent is on whatever platform you're on) to send a double-click message.
Upvotes: 0