2012-04-17 30 views
2

我想模擬Windows應用程序上的圖標點擊。 目前,唯一的方法是使用ClickInput(coords =(x,y))模擬鼠標點擊。 上述方法的問題是,無論何時軟件UI被更新,其位置改變迫使我更新所有根據新圖標位置的腳本。如何使用Pywinauto在Windows應用程序中選擇圖標

有沒有辦法在不使用座標系的情況下模擬工具欄中的圖標點擊?

回答

0

是的!據我所知,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() 
相關問題