大佬们,帮我看看,我这个脚本可以运行,就是识别不出图片触发点击
autohotkey吧
全部回复
仅看楼主
level 1
黄金厉害 楼主
#Persistent#
SingleInstance Forcerunning := falseimgStart := "start.png"imgConfirm := "confirm.png"imgAgain := "again.png"interval := 150F6:: running := !running ToolTip, % running ? "运行中 (F7停)" : "已停止" SetTimer, AutoClick, % running ? interval : "Off"returnF7:: running := false SetTimer, AutoClick, Off ToolTip, 已停止returnAutoClick: ImageSearch, OX, OY, 0, 0, A_ScreenWidth, A_ScreenHeight, %imgStart% if !ErrorLevel { Click, %OX% %OY% Sleep, 100 } ImageSearch, OX, OY, 0, 0, A_ScreenWidth, A_ScreenHeight, %imgConfirm% if !ErrorLevel { Click, %OX% %OY% Sleep, 100 } ImageSearch, OX, OY, 0, 0, A_ScreenWidth, A_ScreenHeight, %imgAgain% if !ErrorLevel { Click, %OX% %OY% Sleep, 100 }return
2026年03月24日 13点03分 1
level 8
原生搜图难用,换V2+FindText
FindText连接:网页链接
DeepSeek帮你转写的一楼代码,我这测试跑通
#Requires AutoHotkey v2.0
#SingleInstance Force
Persistent
; 引入 FindText 库(假设放在 Lib 目录)
#Include <FindText>
; 全局变量
running := false
; 打开FindText抓图,拿到这个转换后的字符串,替换这三个值
imgStart := "|<imgStart>*96$10.DwDoTQRsrsTlyLXQx7
lz
Dy"
imgConfirm := ""
imgAgain := ""
interval := 150
; 热键 F6:切换运行状态
F6::
{
global running, interval
running := !running
ToolTip(running ? "运行中 (F7停)" : "已停止")
if running
SetTimer(AutoClick, interval)
else
SetTimer(AutoClick, 0)
}
; 热键 F7:停止运行
F7::
{
global running
running := false
SetTimer(AutoClick, 0)
ToolTip("已停止")
}
; 自动点击子程序
AutoClick()
{
global imgStart, imgConfirm, imgAgain
static ft := FindTextClass() ; 获取 FindText 默认对象
; 搜索 start 图像
if (ok := ft.FindText(&X, &Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, imgStart))
{
Click(ok[1].1, ok[1].2) ; 使用左上角坐标
Sleep(100)
}
; 搜索 confirm 图像
if (ok := ft.FindText(&X, &Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, imgConfirm))
{
Click(ok[1].1, ok[1].2)
Sleep(100)
}
; 搜索 again 图像
if (ok := ft.FindText(&X, &Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0, 0, imgAgain))
{
Click(ok[1].1, ok[1].2)
Sleep(100)
}
}
2026年03月25日 10点03分 2
1