【发布时间】:2012-04-17 18:10:10
【问题描述】:
我正在尝试模拟单击 Windows 应用程序上的图标。 目前,我这样做的唯一方法是使用 ClickInput(coords = (x,y)) 模拟鼠标点击 上述方法的问题是,每当软件 UI 更新时,它的位置就会发生变化,这迫使我根据新的图标位置更新所有脚本。
有没有办法在不使用坐标的情况下模拟工具条中的图标点击?
【问题讨论】:
标签: click icons simulate pywinauto
我正在尝试模拟单击 Windows 应用程序上的图标。 目前,我这样做的唯一方法是使用 ClickInput(coords = (x,y)) 模拟鼠标点击 上述方法的问题是,每当软件 UI 更新时,它的位置就会发生变化,这迫使我根据新的图标位置更新所有脚本。
有没有办法在不使用坐标的情况下模拟工具条中的图标点击?
【问题讨论】:
标签: click icons simulate pywinauto
是的!据我所知,pywinauto 中的图像看起来像 Static。
Access names : ['Static4']
Class : Static
ClientRects : [<RECT L0, T0, R24, B24>]
ContextHelpID : 0
ControlCount : 0
ControlID : 269
ExStyle : 4
Fonts : [<LOGFONTW 'MS Shell Dlg' -11>]
FriendlyClassName : Static
handle : 2097378
Image : <Image._ImageCrop image mode=RGB size=24x24 at 0x1E47DC8>
IsEnabled : True
IsUnicode : True
IsVisible : True
MenuItems : []
pwa_type : <class 'pywinauto.controls.win32_controls.StaticWrapper'>
Rectangle : (L514, T498, R538, B522)
Style : 1342179331
Texts : ['']
UserData : 0
您可以轻松访问它
window['Static4'].Click()
【讨论】: