望大佬指教,谢谢!
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future Autofotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SysGet, VirtualHeight, 902
SysGet, VirtualWidth, 507
!1::
__ImageFilePath:="C\temp\1.png"
gui,add,picture,hwnd_mypic,%__lmageFilePath%
if FileExist(__lmageFilePath){
controlgetpos,,,__img_w,__img_h,,ahk_id %__mypic%
CoordMode Pixel
ImageSearch,__FoundX,__FoundY, 0, 0, VirtualWidth, VirtualHeight,%__lmageFilePath%
CoordMode Mouse
PicX:=__FoundX + __img_w/2
PicY:=__FoundY+__img_h/2
if (ErrorLevel=0) {
MouseGetPos, NowX, NowY
CoordMode , Mouse , Screen
__ClickX:=PicX
__ClickY:=PicY
__ClickTimes:= 1
Click %__ClickX%, %__ClickY%, %__ClickTimes%
__Clickx:=NowX
__ClickY:=NowY
__ClickTimes:=0
Click %__ClickX%, %__ClickY%, %__ClikTimes%
}else {
}
}else{
}
Return