本帖最后由 xsjtxy 于 2025-4-22 13:49 编辑
求教如何将屏幕截图并查找某个关键字的坐标并返回其X,Y坐标。
通过PixelSearch检测象素的方式实现了。点击360浏览器里面的按键。
Opt("WinTitleMatchMode", 2)
MouseMove(1,1)
WinActivate("360极速浏览器")
sleep(2000)
$coord = PixelSearch(386,30,386,750,5465201)
If Not @error Then
While 1
;MsgBox(0, "X 与 Y 坐标:", $coord[0] & "," & $coord[1])
if PixelGetColor(386,$coord[1]+1)<>11713216 then ExitLoop
if PixelGetColor(386,$coord[1]+2)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+3)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+4)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+5)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+6)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+7)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+8)<>16777215 then ExitLoop
if PixelGetColor(386,$coord[1]+9)<>11910338 then ExitLoop
$d2=PixelGetColor(386,$coord[1]+10)
if $d2 = 5465201 then
MouseMove($coord[0],$coord[1])
sleep(1000)
MouseClick("left")
endif
ExitLoop
WEnd
EndIf
|