本帖最后由 pigWoWo 于 2022-5-26 22:19 编辑
请问大家有 研究过 企业微信的 查找图像,然后点击么?
使用了 Afan 大大的 函数,发现 会有偏移 。
mouseclick 找不到准确的 坐标 。
demo 代码 #Region ;**** 编译指令由 by AutoIt3Wrapper_GUI 创建 ****
#AutoIt3Wrapper_Icon=Z:\vmwareShare\softmgr.ico
#AutoIt3Wrapper_Res_Language=2052
#EndRegion ;**** 编译指令由 by AutoIt3Wrapper_GUI 创建 ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <MsgBoxConstants.au3>
#include<af_search_pic.au3>;包含阿福源代码文件到脚本中
#include <File.au3>
While 1
$t=TimerInit()
search_pic (0,0, @DesktopWidth, @DesktopHeight,@ScriptDir & "\AF1.bmp") ;search_pic($x1,$y1,$x2,$y2,$pic)"当前屏幕找图",说明:$x1:屏幕上的左上角X坐标,$y1:屏幕上的左上角Y坐标,$x2:屏幕上的右下角X坐标,$y2:屏幕上的右下角Y坐标,$pic:要找图的路径及名称,$aPosMsg:返回坐标值(X坐标,Y坐标,长,高)
If $aPosMsg<>"" Then
$array=StringSplit ($aPosMsg,",",2)
MouseMove($array[0],$array[1])
MouseMove($array[0],$array[1])
ConsoleWrite("Find it!" & TimerDiff($t)&@CRLF)
MouseClick("left", $array[0],$array[1])
_FileWriteLog("au3.log","mouseclick[Pos] X:" & $array[0] & "Y:" & $array[1])
MsgBox($MB_SYSTEMMODAL, "标题", "此消息框在 10 秒后超时或选择<确定>按钮.", 10)
Local $aPos = MouseGetPos()
;MsgBox($MB_SYSTEMMODAL, "鼠标位置 x, y:", $aPos[0] & ", " & $aPos[1])
_FileWriteLog("au3.log","mouseGet[Pos] X:" & $aPos[0] & "Y:" & $aPos[1] )
_FileWriteLog("au3_Cha.log","差额[Pos] X:" & $aPos[0] - $array[0] & "Y:" & $aPos[1] -$array[1] )
_FileWriteLog("au3_ALL.log","mouseclick[Pos] X:" & $array[0] & "Y:" & $array[1])
_FileWriteLog("au3_ALL.log","----------------------------" )
_FileWriteLog("au3_ALL.log","mouseGet[Pos] X:" & $aPos[0] & "Y:" & $aPos[1] )
_FileWriteLog("au3_ALL.log","差额[Pos] X:" & $aPos[0] - $array[0] & "Y:" & $aPos[1] -$array[1] )
Else
ConsoleWrite("Sorry, Just Not Find ~~~" & TimerDiff($t)&@CRLF)
EndIf
Sleep(2000)
WEnd
|