这是我用来首先记录鼠标位置的一些代码(相对鼠标位置不起作用,因为窗口是平铺的,并且可以通过移动平铺来更改点击位置)。之后,我立即在记录的位置单击鼠标(稍后在代码中也重做此操作)。
SplashTextOn, 200, 100, Script Preparations, Please Click on the Person `"Search Term`" link (1) in SAP. ; Show new instructions to the user
WinMove, Script Preparations,, (A_ScreenWidth/2)-150, (A_ScreenHeight/2)-200 ; Move the text instructions window with the name "Script Preparations" 150 pixels right of the center of the screen and 200 pixels up SoundBeep 600, 300 ; Wake up user
; From here on the left mouse button will temporarily be disabled
Hotkey, LButton, on ; Turn Left Mouse Button OFF, to capture the Mouse click
KeyWait, LButton, D ; Wait for LeftMouseButton click Down
MouseGetPos, xposS ,yposS ; Store the position where the mouse was clicked (Search Box)
MouseClick, left, %xposS% ,%yposS% ; Perform the mouse click on the captured mouse location
希望这会有所帮助。
在您的情况下,我假设您只需要使用 Window Spy 确定鼠标位置。