屏幕截图查找某个字的坐标并返回其坐标。
本帖最后由 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 & "," & $coord)
if PixelGetColor(386,$coord+1)<>11713216 then ExitLoop
if PixelGetColor(386,$coord+2)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+3)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+4)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+5)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+6)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+7)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+8)<>16777215 then ExitLoop
if PixelGetColor(386,$coord+9)<>11910338 then ExitLoop
$d2=PixelGetColor(386,$coord+10)
if $d2 = 5465201 then
MouseMove($coord,$coord)
sleep(1000)
MouseClick("left")
endif
ExitLoop
WEnd
EndIf
页:
[1]