按键精灵后台鼠标移动和点击脚本怎么制作。

2024-11-03 00:04:45
推荐回答(3个)
回答1:

具体代码如下:
PutAttachment "d:\p", "*.*"

//获取窗口句柄
Hwnd = Plugin.Window.MousePoint()
//获取窗口客户区左上角坐标
sRect = Plugin.Window.GetClientRect(Hwnd)
xyArray = Split(sRect, "|", - 1 , 1)
dx = xyArray(0)
dy = xyArray(1)

//转移窗口
KMData = Plugin.bgkms6_10.KMTransform(hwnd, 0)

//Plugin.BGCP2_02.TransformWindow 参数1

//加载图片
tu = Plugin.BGCP2_02.LoadBMP("d:\p\4.bmp")
tu1 = Plugin.BGCP2_02.LoadBMP("d:\p\12.bmp")
Do
Call Plugin.Bkgnd.KeyPress(Hwnd, 9)
Delay 100
Call Plugin.Bkgnd.KeyPress(Hwnd, 49)
Delay 3000
For 60
Call Plugin.BGCP2_02.FindPicture(hwnd, 0, 0, 1024, 768 ,tu(0), 30, 0.9, ipX, ipY)
If ipX > 0 And ipY > 0 Then
Call Plugin.Bkgnd.KeyPress(Hwnd, 51)
Delay 1000
Call Plugin.BGCP2_02.FindPicture(hwnd, 0, 0, 1024, 768 ,tu1(0), 30, 0.9, intX, intY)
If intX > 0 And intY > 0 Then
Call Plugin.bgkms6_10.MoveTo(KMData, intX, intY) //
Delay 1000
call Plugin.bgkms6_10.LeftClick (KMData) //这里后台点击鼠标左击没反应,是不是那地方写错了?
Delay 200
End If
End If
//End If
Next
Delay 100
Loop
Sub OnScriptExit
//释放转移窗口
Call Plugin.BGCP2_02.UnTransformWindow(Hwnd)
call Plugin.bgkms6_10.KMUntransform (KMData)
End Sub

回答2:

脚本如下
Dim hwnd
Plugin hwnd=Window.MousePoint()
Delay 1000
Rem star
Plugin BGKM5.MMove(hwnd,668,297)//移动左键到“军事行动”
Delay 400
Plugin BGKM5.LClick(hwnd,668,297)//左键单击“军事行动”
Delay 400
Plugin BGKM5.MMove(hwnd,573,199)//移动左键到“第一舰队”
Delay 400
Plugin BGKM5.LClick(hwnd,573,199)//左键单击“第一舰队”
Delay 400
Plugin BGKM5.MMove(hwnd,727,377)//移动左键到“急速”
Delay 400
Plugin BGKM5.LClick(hwnd,727,377)//左键单击“急速“
Delay 400
Plugin BGKM5.MMove(hwnd, 808,405)//左键移动到“确定出击”
Delay 400
Plugin BGKM5.LClick(hwnd,808,405)//左键单击“确定出击”
Delay 400
Plugin BGKM5.MMove(hwnd,758,300)//左键移动到“确定”
Delay 400
Plugin BGKM5.LClick(hwnd,758,300)//左键单击“确定”
Delay 500
Plugin BGKM5.MMove(hwnd,1062,57)//左键移动到“关闭窗口”
Delay 400
Plugin BGKM5.LClick(hwnd,1062,57)//左键单击“关闭窗口”
Delay 400//以上为一个出征循环,多次出征可复制以上内容
Plugin BGKM5.MMove(hwnd,668,297)//移动左键到“军事行动”
Delay 400
Plugin BGKM5.LClick(hwnd,668,297)//左键单击“军事行动”
Delay 400
Plugin BGKM5.MMove(hwnd,573,199)//移动左键到“第一舰队”
Delay 400
Plugin BGKM5.LClick(hwnd,573,199)//左键单击“第一舰队”
Delay 400
Plugin BGKM5.MMove(hwnd,727,377)//移动左键到“急速”
Delay 400
Plugin BGKM5.LClick(hwnd,727,377)//左键单击“急速“
Delay 400
Plugin BGKM5.MMove(hwnd, 808,405)//左键移动到“确定出击”
Delay 400
Plugin BGKM5.LClick(hwnd,808,405)//左键单击“确定出击”
Delay 400
Plugin BGKM5.MMove(hwnd,758,300)//左键移动到“确定”
Delay 400
Plugin BGKM5.LClick(hwnd,758,300)//左键单击“确定”
Delay 500
Plugin BGKM5.MMove(hwnd,1062,57)//左键移动到“关闭窗口”
Delay 400
Plugin BGKM5.LClick(hwnd,1062,57)//左键单击“关闭窗口”
Delay 400
Plugin BGKM5.MMove(hwnd,668,297)//移动左键到“军事行动”
Delay 120000

回答3:

呵呵
缺少goto star