高手帮忙写个大漠后台插件的脚本范例。包含:绑定游戏窗口、后台鼠标移动,键盘操作。 10
1个回答
展开全部
PutAttachment "D:\tianxiahoutai", "*.*"//释放附件
set ws=createobject("Wscript.Shell")
ws.run "regsvr32 d:\tianxia\dm.dll /s"
Set ws = nothing
Delay 1500//注册插件
Set dm = createobject("dm.dmsoft")//创建大漠对象
dm.SetPath "D:\tianxiahoutai"//设置全盘路径
dm.SetDict 0, "D:\tianxiahoutai\tianxiazk1.txt"//设定字库
hwnds = dm.EnumWindow("0", "117.135.138.155/tx33", "", 1 + 4 + 8 + 16)
//枚举窗口标题为117.135.138.155/tx33的窗口,把句柄赋值给hwnds
hwnds = split(hwnds,",")
//数组分割函数
hwnd = dm.FindWindowEx( hwnds, "Frame Tab", "")
Delay 200
hwnd = dm.FindWindowEx(hwnd, "TabWindowClass", "")
Delay 200
dm_ret = dm.SetWindowState(hwnd,1)
Delay 200
//获取客户区句柄
dm_ret = dm.BindWindowEx(hwnd, "dx2", "windows3", "windows", "", 0)
//绑定窗口
Delay 1000
dm_ret = dm.FindStrFast(0,0,1024,800,"驿站","4800ff-df9cff",0.9,tx_sxX,tx_sxY)
//大漠的找字
If tx_sxX >= 0 and tx_sxY >= 0 Then
dm.moveto tx_sxX, tx_sxY
//大漠的鼠标移动
Delay 500
dm.leftclick
//大漠的左键单击
。。。。。。。。。。。。。。。。。。。。。
//这里是你自己书写的代码
Sub OnScriptExit()
dm_ret = dm.UnBindWindow()
End Sub
//解除窗口绑定
set ws=createobject("Wscript.Shell")
ws.run "regsvr32 d:\tianxia\dm.dll /s"
Set ws = nothing
Delay 1500//注册插件
Set dm = createobject("dm.dmsoft")//创建大漠对象
dm.SetPath "D:\tianxiahoutai"//设置全盘路径
dm.SetDict 0, "D:\tianxiahoutai\tianxiazk1.txt"//设定字库
hwnds = dm.EnumWindow("0", "117.135.138.155/tx33", "", 1 + 4 + 8 + 16)
//枚举窗口标题为117.135.138.155/tx33的窗口,把句柄赋值给hwnds
hwnds = split(hwnds,",")
//数组分割函数
hwnd = dm.FindWindowEx( hwnds, "Frame Tab", "")
Delay 200
hwnd = dm.FindWindowEx(hwnd, "TabWindowClass", "")
Delay 200
dm_ret = dm.SetWindowState(hwnd,1)
Delay 200
//获取客户区句柄
dm_ret = dm.BindWindowEx(hwnd, "dx2", "windows3", "windows", "", 0)
//绑定窗口
Delay 1000
dm_ret = dm.FindStrFast(0,0,1024,800,"驿站","4800ff-df9cff",0.9,tx_sxX,tx_sxY)
//大漠的找字
If tx_sxX >= 0 and tx_sxY >= 0 Then
dm.moveto tx_sxX, tx_sxY
//大漠的鼠标移动
Delay 500
dm.leftclick
//大漠的左键单击
。。。。。。。。。。。。。。。。。。。。。
//这里是你自己书写的代码
Sub OnScriptExit()
dm_ret = dm.UnBindWindow()
End Sub
//解除窗口绑定
更多追问追答
追问
以下是我写的:
set dm = createobject("dm.dmsoft")
dm.SetPath "E:\Download\3.1227\3.1227"
hwnd = dm.GetMousePointWindow()
dm_ret = dm.BindWindow(hwnd,"dx","dx","dx",0)
Delay 3000
Plugin.dm.MoveTo 257,529
Delay 200
Plugin.dm.LeftClick
Delay 200
Plugin.dm.KeyPress 72
Sub OnScriptExit()
dm_ret = dm.UnBindWindow()
End Sub
前台可以运行,后台不行,压下游戏后脚本在前台运行。
追答
确定你要做的目标程序支持后台??
你先用后台截图看下窗口的绑定是否成功
Plugin.dm.LeftClick 改为dm.LeftClick
Plugin.dm.KeyPress 72改为dm.KeyPress 72
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询