2

我正在尝试获取窗口的位置,因此我可以编写一个脚本来双击该窗口。在 AutoHotkey 中有什么方法可以做到这一点吗?

4

2 回答 2

2

这个问题有标签,所以我认为它是关于AutoHotkey的,对吧?如果是,您只需要WinGetPos命令,即可获取x,y窗口左上角的坐标。

WinGetPos [, X, Y, Width, Height, WinTitle, WinText, ExcludeTitle, ExcludeText]

前四个参数是变量的名称,将获取有关窗口的信息。最后四个参数是几乎所有 AutoHotkey Win 命令的标准参数,它们标识窗口。

简单的例子:

SetTitleMatchMode 2             ;# match window title in any place
IfWinExist, Notepad
    WinGetPos, Xpos, Ypos       ;# Uses the window found above.

这会将记事本窗口位置放入Xpos,Ypos变量中。
然后您可以使用带有ClickXpos命令的这些Ypos变量来发送点击。

于 2010-03-05T09:55:12.617 回答
0

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.

于 2010-02-26T04:10:46.597 回答