[按键精灵] 纯文本查看 复制代码
Global TaskID, ArrData(99, 5)
EndScript
Sub StartTask()
Dim HwndArr,i,HwndButton,HwndEx,HwndButtonEx
RunApp "Notepad.exe"
For 10
HwndArr = Plugin.WndEx7_71.EnumWindowA(0, 0, "Notepad", 16)
If UBound(HwndArr) > - 1 Then
For i = 0 To UBound(HwndArr)
HwndButton = Plugin.WndEx7_71.EnumWindowA(HwndArr(i), 0, "361DuButtonClass9", 4)
If Ubound(HwndButton) = - 1 Then
'假设这个窗口是新的
HwndButtonEx = Plugin.WndEx7_71.CreateButton(HwndArr(i),0,0,0,0)
HwndEx = Plugin.WndEx7_71.FindWindowEx(HwndArr(i), 0, "Edit", 0)
Exit For
'Call Plugin.WndEx7_71.SetWindowText(HwndButton, "啊张工作室")
End If
Next
End If
If HwndButtonEx > 0 Then
Exit For
End If
Next
TaskID = TaskID + 1
i = TaskID
ArrData(i, 0) = i
ArrData(i, 1) = HwndEx
ArrData(i, 2) = GetThreadID()
ArrData(i, 3) = "Running"
Do
If Form2.Grid1.GetItemText(i, 5) = "" Then
Form2.Grid1.SetItemText i, 5, "啊张工作室"
Else
Call Plugin.WndEx7_71.SendString(HwndEx,Now()&" "&Form2.Grid1.GetItemText(i, 5)&" "&Chr(13))
'Call Plugin.Bkgnd.KeyPress(HwndEx,13)
Delay 999
ArrData(i, 4) = ArrData(i, 4) + 1
If ArrData(i, 4) > 100 Then
ArrData(i, 3) = "Finish"
Exit Do
End If
End If
Loop
End Sub
Function Main(Content)
MessageBox Content
End Function
Function Include_dmsoft(reg_code)
'首先把dm.dll和regdll.dll二个文件放入附件中,课堂上的做法是,把dm.dll放到附
'件中,然后把regdll.dll放到按键精灵的Plugin目录下,进行.但实际情况会出现注册
'失败无法创建大漠对象.
FilePath = "E:\AnJian" '定义一个文件路径
'释放dm.dll到定义的文件路径,有时会出现创建对象失败,可以把释放附件的文件改成"*.*"
PutAttachment FilePath&"\","dm.dll" '释放dm.dll到定义的文件路径
'注册大漠手册到系统
Call Plugin.RegDll.Reg(FilePath & "\dm.dll")
'创建大漠对象,前提是必须注册大漠成功
Set dm = CreateObject("dm.dmsoft")
'获取大漠的版本号
NeedVersion = dm.ver()
'输出大漠版本号,输出成功,说明注册和创建对象成功
If NeedVersion = 7.1904 Then
TracePrint "大漠插件注册成功,所用版本为 "&NeedVersion
End If
dm_ret = dm.Reg(reg_code,"0001") // abcdefg是您的注册码. 在大漠插件网站后台可以直接获取.
if dm_ret <> 1 then
messagebox "注册失败,返回值是:"&dm_ret
endscript
end if
End Function
Event Form2.Button_CreateTask.Click
Thd = BeginThread(StartTask)
End Event
Event Form1.LoadOver
Dim Hwnd,HwndEx
Hwnd = Plugin.WndEx7_71.GetWindow(Form1.Hwnd, 7)
Call Plugin.WndEx7_71.SetWindowState(Hwnd, 3)
'隐藏任务栏上的窗口
OldInfo = Plugin.WndEx7_71.HideWindowFormTaskbar(hwnd)
Delay 2000
Form2.Show
HwndEx = Plugin.WndEx7_71.GetWindow(Form2.Hwnd, 7)
'激活 窗口 2
Call Plugin.WndEx7_71.SetWindowState(HwndEx,1)
End Event
Event Form2.LoadOver
Form2.Grid1.RowCount = 1
End Event
Event Form2.Timer1.Timer
Dim TimeI
Form2.Grid1.RowCount = TaskID + 1
For TimeI = 1 To TaskID
Form2.Grid1.SetItemText TimeI, 0, ArrData(TimeI,0)
Form2.Grid1.SetItemText TimeI, 1, ArrData(TimeI,1)
Form2.Grid1.SetItemText TimeI, 2, ArrData(TimeI,2)
Form2.Grid1.SetItemText TimeI, 3, ArrData(TimeI, 3)
Form2.Grid1.SetProgressBarValue TimeI, 4, ArrData(TimeI, 4)
Next
End Event
Event Form2.Button_DestroyTask.Click
Form2.Grid1.GetSelectedRange x1, y1, x2, y2
TracePrint x1 & " , " & y1 & " , " & x2 & " , " & y2
For i = x1 To x2
StopThread (ArrData(i, 2))
ArrData(i, 3) = "The End"
Next
End Event
Event Form2.Button_Pause.Click
Form2.Grid1.GetSelectedRange x1, y1, x2, y2
TracePrint x1 & " , " & y1 & " , " & x2 & " , " & y2
For i = x1 To x2
If ArrData(i, 3) = "Running" Then
PauseThread ArrData(i, 2)
ArrData(i, 3) = "Pausing"
ElseIf ArrData(i, 3) = "Pausing" Then
ContinueThread ArrData(i, 2)
ArrData(i, 3) = "Running"
End If
Next
End Event
Event Form2.UnLoad
'在脚本关闭时,终止所有进程
For i = 1 To TaskID
TracePrint "终止第 " & i & " 行, 线程句柄为 " & ArrData(i, 2) & " 线程"
StopThread ArrData(i, 2)
Next
Hwnd = Plugin.WndEx7_71.GetWindow(Form1.Hwnd, 7)
Call Plugin.WndEx7_71.SetWindowState(Hwnd,0)
End Event