- 超级版主
- 1228894
- 26984
- 25
- 8059 朵
- 36138 个
- 4755 个
- 421340
- 2012-07-18
|
1#
t
T
发表于 2020-10-22 23:59
|
|只看楼主
1.脚本属性>☐ 禁止重复运行(勾去掉) 2.保存退出(必须在非调试界面才有效)>鼠标指向需要运行的窗口>按热键F10启动 - TracePrint "goto~"
- Hwnd = Plugin.Window.MousePoint()
- Do
- Call Plugin.Bkgnd.KeyPress(Hwnd, 65)
- Delay 1000
- Loop
复制代码- Do
- key = WaitKey()
- If key = 65 Then '按A键启动新线程
- BeginThread 按键()
- End If
- Loop
- Sub 按键()
- Hwnd = Plugin.Window.MousePoint()
- Do
- Call Plugin.Bkgnd.KeyPress(Hwnd, 49)
- Delay 200
- loop
- End Sub
复制代码- DimEnv s
- HwndEx = Plugin.Window.Search("记事本")
- Hwnd = Split(HwndEx, "|")
- For i=0 to UBound(Hwnd)-1
- s= Hwnd(i)
- BeginThread 脚本()
- Delay 100
- Next
- Sub 脚本()
- Hwnd = Plugin.Window.FindEx(s, 0, 0, 0)
- TracePrint Hwnd
- Do
- Call Plugin.Bkgnd.KeyPress(Hwnd, 65)
- Delay 1000
- Loop
- End Sub
复制代码- Dimenv 环境变量句柄
- ID句柄字符串 = ""
- set dm = createobject("dm.dmsoft")
- do
- Call Plugin.Msg.Tips("按Insert键绑定,按Delete键解绑")
- Key = WaitKey()
- If Key = 45 Then
- 环境变量句柄 = dm.GetMousePointWindow()
- 位置 = Instr(ID句柄字符串, 环境变量句柄)
- If 位置 = 0 Then
- 线程ID = BeginThread(多线程)
- 句柄 = CStr(环境变量句柄)
- ID = CStr(线程ID)
- ID句柄字符串 = 句柄 + "|" + ID + "|" + ID句柄字符串
- Call Plugin.Msg.Tips("已绑定,一个窗口")
- Else
- Call Plugin.Msg.Tips("窗口已经绑定过了,请不要重复绑定")
- Delay 2500
- End If
- ElseIf Key = 46 Then
- 鼠标指向的句柄 = dm.GetMousePointWindow()
- 位置 = Instr(ID句柄字符串, 鼠标指向的句柄)
- If 位置 > 0 Then
- 数组 = Split(ID句柄字符串, 鼠标指向的句柄)
- ID = 数组(1)
- 数组2 = Split(ID, "|")
- ID2 = 数组2(1)
- StopThread ID2
- TracePrint ID句柄字符串
- 删除数组 = Split(ID句柄字符串, 鼠标指向的句柄)
- 左边 = 删除数组(0)
- ID3= ID2+"|"
- 删除数组2 = Split(ID句柄字符串, ID3)
- 右边 = 删除数组2(1)
- ID句柄字符串 = 左边 + 右边
- Call Plugin.Msg.Tips("已解绑,一个窗口")
- Else
- Call Plugin.Msg.Tips("窗口都没绑定过,你解绑什么嗯,想下标越界么")
- Delay 2500
- End If
- End If
- Delay 1500
- Call Plugin.Msg.Tips("")
- Loop
- Sub 多线程
- set dm = createobject("dm.dmsoft")
- 绑定
- Do
- dm. KeyPress 65
- Delay 1000
- Loop
- End Sub
- Sub 绑定()
- hwnd = 环境变量句柄
- dm_ret = dm.BindWindow( hwnd, "gdi2", "windows", "windows",0)
- If dm_ret=0 Then
- MessageBox "错误;请把鼠标移到游戏窗口内,再启动脚本"
- End If
- End Sub
- Sub OnScriptExit()
- dm.UnBindWindow
- End Sub
复制代码- Dim 启动快捷键, 暂停快捷键, 继续快捷键, 停止快捷键, i, Hwnds(99), 线程ID(99)
- DimEnv Hwnd
- HwndEx = Plugin.Window.Search("记事本")
- Hwnd1 = Split(HwndEx, "|")
- For i = 0 To UBound(Hwnd1)-1
- TracePrint Hwnd1(i)
- Hwnds(i) = Plugin.Window.FindEx(Hwnd1(i), 0, 0, 0)
- Hwnd=Hwnds(i)
- 线程ID(i) = BeginThread(测试线程)
- Delay 500
- Next
- Do
- 等待按键 = GetLastKey()
- Select Case 等待按键
- Case 65
- Hwnd = Plugin.Window.MousePoint()
- For w = 0 To i
- If Hwnds(w) = Hwnd Then
- StopThread 线程ID(w)
- End If
- Next
- End Select
- Loop
- Sub 测试线程
- s = Hwnd
- TracePrint Hwnd
- Delay 100
- Do
- Call Plugin.Window.SendString(s, "测试")
- Delay 1000
- Call Plugin.Window.SendKeyPress(s, 13)
- Delay 1000
- Loop
- End Sub
复制代码- Dim 启动快捷键, 暂停快捷键, 继续快捷键, 停止快捷键,i,Hwnds(99),Hwnd,线程ID(99)
- i = 0
- Do
- 等待按键 = GetLastKey()
- Select Case 等待按键
- Case 65
- Hwnds(i) = Plugin.Window.MousePoint()
- 线程ID(i) = BeginThread(测试线程)
- i=i+1
- Case 66
- Hwnd = Plugin.Window.MousePoint()
- For w = 0 To i
- If Hwnds(w) = Hwnd Then
- PauseThread 线程ID(w)
- End If
- Next
- Case 67
- Hwnd = Plugin.Window.MousePoint()
- For w = 0 To i
- If Hwnds(w) = Hwnd Then
- ContinueThread 线程ID(w)
- End If
- Next
- Case 68
- Hwnd = Plugin.Window.MousePoint()
- For w = 0 To i
- If Hwnds(w) = Hwnd Then
- StopThread 线程ID(w)
- End If
- Next
- End Select
- Loop
- Sub 测试线程
- Hwnd = Plugin.Window.MousePoint()
- Delay 100
- Do
- Call Plugin.Window.SendString(Hwnd, "测试")
- Delay 1000
- Call Plugin.Window.SendKeyPress(Hwnd, 13)
- Delay 1000
- Loop
- End Sub
复制代码- DimEnv 临时句柄
- Sub 脚本()
- Hwnd = Plugin.Window.FindEx(临时句柄, 0, 0, 0)
- TracePrint Hwnd
- Do
- Call Plugin.Bkgnd.KeyPress(Hwnd, 65)
- Delay 1000
- Loop
- End Sub
- Event Form1.Button1.Click
- HwndEx = Plugin.Window.Search("记事本")
- Hwnd = Split(HwndEx, "|")
- Form1.Grid1.RowCount=UBound(Hwnd)+1
- For i = 0 To UBound(Hwnd) - 1
- TracePrint Hwnd(i)
- Form1.Grid1.SetItemText (i+1),0,Hwnd(i)
- Next
- End Event
- Event Form1.Button2.Click
- BeginThread 监测
- End Event
- Sub 监测()
- Do
- For i = 0 To Form1.Grid1.RowCount-2
- 多选框值 = Form1.Grid1.GetCheckBoxValue((i + 1), 2)
- ID值 = Form1.Grid1.GetItemText((i + 1), 1)
- If 多选框值 = 1 and ID值="" Then
- TracePrint (i + 1) & "行勾选了,准备启动"
- 临时句柄=Form1.Grid1.GetItemText((i + 1), 0)
- 线程ID = BeginThread(脚本)
- Form1.Grid1.SetItemText (i + 1), 1,线程ID
- Delay 1000
- End If
- If 多选框值 = 0 and ID值<>"" Then
- TracePrint (i + 1) & "行取消勾选,准备停止"
- StopThread Form1.Grid1.GetItemText((i + 1), 1)
- Form1.Grid1.SetItemText (i + 1), 1,""
- Delay 1000
- End If
- Delay 100
- Next
- Loop
- End Sub
复制代码
|