按键精灵 脚本找多个同样的图 依次单击!
答案:2 悬赏:20 手机版
解决时间 2021-02-19 07:05
- 提问者网友:我没有何以琛的痴心不悔
- 2021-02-18 21:43
按键精灵 脚本找多个同样的图 依次单击!
最佳答案
- 五星知识达人网友:舊物识亽
- 2021-02-18 23:00
Dim ta(4), tb(1)//申明两个数组来存放图片
//假设图A类有5张图.图的名称为:图A-1,图A-2...
For i = 0 To UBound(ta)
i1 = i+1
ta(i) = "Attachment:图A-" & i1 & ".bmp"//循环给数组A赋值
Next
For i = 0 To UBound(tb)
i1 = i+1
tb(i) = "Attachment:图B-" & i1 & ".bmp"//循环给数组B赋值
Next
i = 0
Do
FindPic 0,0,1024,768,ta(i),0.9,intX,intY
If intX > 0 And intY > 0 Then
i1 = 0
Do
FindPic 0, 0, 1024, 768, tb(i1), 0.9, intX, intY
If intX > 0 And intY > 0 Then
MoveTo intX + 5, intY + 5
Delay 10
LeftClick 1
Exit Do//找到单击后跳出找图B的循环
Else
i1 = i1 + 1//找不到就找B类下一个图
If i1 = 2 Then //如果B类都没有找到,就一直不停的找
i1 = 0
End If
End If
Delay 200
loop
End If
i = i + 1
If i > UBound(ta) Then //如果找到A类最后一张图,则返回重找
i = 0
End If
Delay 200
Loop如果图片的命名方式不规则,就只能一个一个的给数组赋值
追问亲,B组图是两张会变化的图片。。。追答会变化的图是什么意思?既然你都不知道会出哪张图,让程序如何去找呢追问亲,我重新整理了下思路,补充内容应该更直观些吧!
PS:所谓”会变化的图“也就是有2张同类作用的图,以B类图为例,第一次显示的是B1这张图,单击后因为某些原因,下次会变成B2这张图,但作用没变!所以依次查找B1、B2、找到其中一张单击即可!追答//创建大漠对象
Set dm = createobject("dm.dmsoft")
//
//设置全局路径 ,就是图片所在路径
dm_setpath "d:\zz_game"
//
hwnd = dm.GetMousePointWindow()
dm_ret = dm.BindWindow(hwnd,"gdi","windows","windows",0)
Delay 1500
//
Dim ta(4)
For i = 0 To UBound(ta)
i1 = i+1
ta(i) = "A" & i1 & ".bmp"//循环给数组A赋值
Next
For i = 0 To UBound(ta)
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, ta(i), "000000", 0.9, 0, intX, intY)
Delay 200
Loop Until intX > 0
Call 单击(intX + 5, intY + 5)
Delay 1000
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, "B1.bmp|B2.bmp", "000000", 0.9, 0, intX, intY)
Delay 200
Loop Until intX > 0
Call 单击(intX + 5, intY + 5)
Delay 1000
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, "C1.bmp|C2.bmp", "000000", 0.9, 0, intX, intY)
Delay 200
Loop Until intX > 0
Call 单击(intX + 5, intY + 5)
Delay 1000
Next
//
Sub 单击(x, y)
dm.MoveTo x, y
Delay 20
dm.LeftClick
End Sub追问图片我该如何命名及添加呢!追答A1.bmp
A2.bmp
B1.bmp
C1.bmp追问亲有什么联系方式吗追答我服你了,加Q吧
//假设图A类有5张图.图的名称为:图A-1,图A-2...
For i = 0 To UBound(ta)
i1 = i+1
ta(i) = "Attachment:图A-" & i1 & ".bmp"//循环给数组A赋值
Next
For i = 0 To UBound(tb)
i1 = i+1
tb(i) = "Attachment:图B-" & i1 & ".bmp"//循环给数组B赋值
Next
i = 0
Do
FindPic 0,0,1024,768,ta(i),0.9,intX,intY
If intX > 0 And intY > 0 Then
i1 = 0
Do
FindPic 0, 0, 1024, 768, tb(i1), 0.9, intX, intY
If intX > 0 And intY > 0 Then
MoveTo intX + 5, intY + 5
Delay 10
LeftClick 1
Exit Do//找到单击后跳出找图B的循环
Else
i1 = i1 + 1//找不到就找B类下一个图
If i1 = 2 Then //如果B类都没有找到,就一直不停的找
i1 = 0
End If
End If
Delay 200
loop
End If
i = i + 1
If i > UBound(ta) Then //如果找到A类最后一张图,则返回重找
i = 0
End If
Delay 200
Loop如果图片的命名方式不规则,就只能一个一个的给数组赋值
追问亲,B组图是两张会变化的图片。。。追答会变化的图是什么意思?既然你都不知道会出哪张图,让程序如何去找呢追问亲,我重新整理了下思路,补充内容应该更直观些吧!
PS:所谓”会变化的图“也就是有2张同类作用的图,以B类图为例,第一次显示的是B1这张图,单击后因为某些原因,下次会变成B2这张图,但作用没变!所以依次查找B1、B2、找到其中一张单击即可!追答//创建大漠对象
Set dm = createobject("dm.dmsoft")
//
//设置全局路径 ,就是图片所在路径
dm_setpath "d:\zz_game"
//
hwnd = dm.GetMousePointWindow()
dm_ret = dm.BindWindow(hwnd,"gdi","windows","windows",0)
Delay 1500
//
Dim ta(4)
For i = 0 To UBound(ta)
i1 = i+1
ta(i) = "A" & i1 & ".bmp"//循环给数组A赋值
Next
For i = 0 To UBound(ta)
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, ta(i), "000000", 0.9, 0, intX, intY)
Delay 200
Loop Until intX > 0
Call 单击(intX + 5, intY + 5)
Delay 1000
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, "B1.bmp|B2.bmp", "000000", 0.9, 0, intX, intY)
Delay 200
Loop Until intX > 0
Call 单击(intX + 5, intY + 5)
Delay 1000
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, "C1.bmp|C2.bmp", "000000", 0.9, 0, intX, intY)
Delay 200
Loop Until intX > 0
Call 单击(intX + 5, intY + 5)
Delay 1000
Next
//
Sub 单击(x, y)
dm.MoveTo x, y
Delay 20
dm.LeftClick
End Sub追问图片我该如何命名及添加呢!追答A1.bmp
A2.bmp
B1.bmp
C1.bmp追问亲有什么联系方式吗追答我服你了,加Q吧
全部回答
- 1楼网友:人间朝暮
- 2021-02-19 00:25
Call 注册
Call 绑定
A类 = "a1.bmp|a2.bmp|a3.bmp|a4.bmp|a5.bmp"//如果图片多,可以再加
A类 = split(A类, "|")//数组
B类 = "b1.bmp|b2.bmp"
C类 = "c1.bmp|c2.bmp"
Do//这个是无限循环,当A类的N个图片找完后,反回继续从A类第一个图片开始找,如此反复,直到你停止脚本运行
For i = 0 To UBound(A类)
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, A类(i), "000000", 0.9, 0, x, y)
If x >= 0 and y >= 0 Then
dm.MoveTo x + 5, y + 5
Delay 100
dm.LeftClick
Delay 100
Exit Do//找到A类第i个图后跳出循环,否则一直找
End If
Delay 100
Loop
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, 图B, "000000", 0.9, 0, x, y)
If x >= 0 and y >= 0 Then
dm.MoveTo x + 5, y + 5
Delay 100
dm.LeftClick
Delay 100
Exit Do //找到B类图内的任一图片后跳出循环,否则一直找
End If
Delay 100
Loop
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, 图C, "000000", 0.9, 0, x, y)
If x >= 0 and y >= 0 Then
dm.MoveTo x + 5, y + 5
Delay 100
dm.LeftClick
Delay 100
Exit Do//找到C类图内的任一图片后跳出循环,否则一直找
End If
Delay 100
Loop
//这组找完,返回并找下一个A类图片
Next
//A类图片都找完了,如果想一直循环找,就加一个无限循环
Loop
Sub 绑定
Rem 绑定
hwnd = dm.GetMousePointWindow()
Delay 100
dm_ret = dm.BindWindow(hwnd,"dx2","windows2","dx",0)
Delay 1000
If dm_ret = 1 Then
Call Plugin.Msg.Tips("绑定成功")
Delay 100
Else
Goto 绑定
End If
End Sub
Sub 注册大漠()
need_ver = "3.1233"
Delay 50
set ws=createobject("Wscript.Shell")
Delay 50
ws.run "regsvr32 atl.dll /s"
Delay 50
set ws=nothing
PutAttachment "c: est_game","*.*"
Delay 50
PutAttachment ".Plugin", "RegDll.dll"
Delay 50
Call Plugin.RegDll.Reg("c: est_gamedm.dll")
Delay 50
set dm = createobject("dm.dmsoft")
Delay 50
ver = dm.Ver()
Delay 50
if ver <> need_ver then
Delay 50
set dm = nothing
Delay 50
set ws=createobject("Wscript.Shell")
Delay 50
ws.run "regsvr32 c: est_gamedm.dll /s"
Delay 50
set ws=nothing
Delay 50
set dm = createobject("dm.dmsoft")
Delay 50
ver = dm.Ver()
Delay 50
if ver <> need_ver then
messagebox "插件版本错误,当前使用的版本是:"&ver&",插件所在目录是:"&dm.GetBasePath()
messagebox "请关闭程序,重新打开本程序再尝试"
endscript
end if
end if
dm.SetPath "c: est_game"
Delay 50
dm_ret = dm.SetDict(0, "dm_soft.txt")
Delay 50
End Sub
Sub OnScriptExit()
dm.UnBindWindow
End Sub
如果你的大漠插件不是3.1233版本,请将注册开头的 need_ver = "3.1233" 改为你用的大漠插件版本号追问亲,代码复制后附件加入图片,脚本不单击B类图啊~
其实只需要鼠标后台就行了~如果方便的话不用大漠会好些!追答将119行的 “Sub 注册大漠() ” 改成 “sub 注册”追问额那个改了也不行,已执行到“绑定成功”不知道第一项有没有选择,但没有单击B类图,A图也只到第二张就不动了追答你加入调试信息呀,能看到脚本执行到哪一步
图B 和 图C 改成B类 和C类,变量我弄错了
Call 绑定
A类 = "a1.bmp|a2.bmp|a3.bmp|a4.bmp|a5.bmp"//如果图片多,可以再加
A类 = split(A类, "|")//数组
B类 = "b1.bmp|b2.bmp"
C类 = "c1.bmp|c2.bmp"
Do//这个是无限循环,当A类的N个图片找完后,反回继续从A类第一个图片开始找,如此反复,直到你停止脚本运行
For i = 0 To UBound(A类)
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, A类(i), "000000", 0.9, 0, x, y)
If x >= 0 and y >= 0 Then
dm.MoveTo x + 5, y + 5
Delay 100
dm.LeftClick
Delay 100
Exit Do//找到A类第i个图后跳出循环,否则一直找
End If
Delay 100
Loop
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, 图B, "000000", 0.9, 0, x, y)
If x >= 0 and y >= 0 Then
dm.MoveTo x + 5, y + 5
Delay 100
dm.LeftClick
Delay 100
Exit Do //找到B类图内的任一图片后跳出循环,否则一直找
End If
Delay 100
Loop
Do
dm_ret = dm.FindPic(0, 0, 2000, 2000, 图C, "000000", 0.9, 0, x, y)
If x >= 0 and y >= 0 Then
dm.MoveTo x + 5, y + 5
Delay 100
dm.LeftClick
Delay 100
Exit Do//找到C类图内的任一图片后跳出循环,否则一直找
End If
Delay 100
Loop
//这组找完,返回并找下一个A类图片
Next
//A类图片都找完了,如果想一直循环找,就加一个无限循环
Loop
Sub 绑定
Rem 绑定
hwnd = dm.GetMousePointWindow()
Delay 100
dm_ret = dm.BindWindow(hwnd,"dx2","windows2","dx",0)
Delay 1000
If dm_ret = 1 Then
Call Plugin.Msg.Tips("绑定成功")
Delay 100
Else
Goto 绑定
End If
End Sub
Sub 注册大漠()
need_ver = "3.1233"
Delay 50
set ws=createobject("Wscript.Shell")
Delay 50
ws.run "regsvr32 atl.dll /s"
Delay 50
set ws=nothing
PutAttachment "c: est_game","*.*"
Delay 50
PutAttachment ".Plugin", "RegDll.dll"
Delay 50
Call Plugin.RegDll.Reg("c: est_gamedm.dll")
Delay 50
set dm = createobject("dm.dmsoft")
Delay 50
ver = dm.Ver()
Delay 50
if ver <> need_ver then
Delay 50
set dm = nothing
Delay 50
set ws=createobject("Wscript.Shell")
Delay 50
ws.run "regsvr32 c: est_gamedm.dll /s"
Delay 50
set ws=nothing
Delay 50
set dm = createobject("dm.dmsoft")
Delay 50
ver = dm.Ver()
Delay 50
if ver <> need_ver then
messagebox "插件版本错误,当前使用的版本是:"&ver&",插件所在目录是:"&dm.GetBasePath()
messagebox "请关闭程序,重新打开本程序再尝试"
endscript
end if
end if
dm.SetPath "c: est_game"
Delay 50
dm_ret = dm.SetDict(0, "dm_soft.txt")
Delay 50
End Sub
Sub OnScriptExit()
dm.UnBindWindow
End Sub
如果你的大漠插件不是3.1233版本,请将注册开头的 need_ver = "3.1233" 改为你用的大漠插件版本号追问亲,代码复制后附件加入图片,脚本不单击B类图啊~
其实只需要鼠标后台就行了~如果方便的话不用大漠会好些!追答将119行的 “Sub 注册大漠() ” 改成 “sub 注册”追问额那个改了也不行,已执行到“绑定成功”不知道第一项有没有选择,但没有单击B类图,A图也只到第二张就不动了追答你加入调试信息呀,能看到脚本执行到哪一步
图B 和 图C 改成B类 和C类,变量我弄错了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯