[General]
Description=命令检测：全面测试升级版
BeginHotkey=121
BeginHotkeyMod=0
PauseHotkey=0
PauseHotkeyMod=0
StopHotkey=123
StopHotkeyMod=0
RunOnce=1
EnableWindow=
Enable=0
AutoRun=0
[Repeat]
Type=0
Number=1
[Relative]
SetupOCXFile=
[Comment]
Content=

[Script]
Plugin AllStartTime = Sys.GetTime()
//PutAttachment Plugin *.bmp
set TiShiObj = createobject("WScript.Shell")
TestFileFolder = "c:\Qm_Auto_Test\"
TestFilePath = TestFileFolder & "测试报告.txt"
PaintTitle = "未命名 - 画图"
PaintViewClass = "AfxFrameOrView42u"
PaintClientClass = "Afx:1000000:8"
NotepadTitle = "无标题 - 记事本"
Plugin File.DeleteFolder("c:\Qm_Auto_Test")
Delay 300
Plugin File.CreateFolder("c:\Qm_Auto_Test")
Delay 300
TestItemTitle = "开始测试，请不要移动鼠标"
ScRX = 800
ScRY = 600
Gosub [提示信息]
TestItemNum = 1
Plugin File.WriteFileEx(TestFilePath,"获取用户系统配置")
Gosub [获取机器详细硬件信息]
Gosub [获取机器主要硬件信息]
Gosub [用WMI对象列出系统所有进程]
Plugin File.WriteFileEx(TestFilePath,"开始测试")
Gosub [测试Sys(系统)插件]
Gosub [获取当前鼠标位置]
Gosub [获取鼠标形状]
Gosub [获取指定点颜色]
Gosub [查找颜色]
Gosub [查找中心颜色]
Gosub [查找颜色扩展]
Gosub [读取内存]
Gosub [测试Memory(内存/进程)插件]
Gosub [测试Color(颜色)插件]
Gosub [测试File(文件)插件]
Gosub [测试Bkgnd(后台控制)插件]
Gosub [测试Window(窗口)插件]
Gosub [测试Media(多媒体)插件]
//Gosub [测试Msg(信息提示)插件]
//Gosub [测试Pic(图像)插件]
Gosub [测试Office(办公文档)插件]
//Gosub [测试Console(控制台)插件]
Gosub [测试Encrypt(加解密)插件]
Gosub [测试Net(网络)插件]
Gosub [测试Web(网页)插件]
Plugin AllEndTime = Sys.GetTime()
Plugin File.WriteFileEx(TestFilePath,"全部测试结束，总共耗时" & AllEndTime-AllStartTime & "毫秒")
MsgBox "全部测试结束，总共耗时" & AllEndTime-AllStartTime & "毫秒,点确定后查看测试结果！"
VBSCall RunApp(TestFileFolder)
EndScript 
Sub [提示信息]
    Plugin Msg.HideScrTXT()
    Delay 100
    Plugin Msg.ShowScrTXT(0, 0, ScRX, ScRY, TiShiXinXi, "0000FF")
    Delay 100
Return [提示信息]
Sub [截图]
    TiShiXinXi = ScreenSnapShotTitle
    Gosub [提示信息]
    Plugin Pic.PrintScreen(0, 0, ScRX, ScRY, TestFileFolder & ScreenSnapShotTitle & ".jpg")
Return [截图]
Sub [开始测试]
    TiShiXinXi = TestItemTitle & "测试开始！"
    Gosub [提示信息]
    Plugin StartTime=Sys.GetTime()
    Plugin File.WriteFileEx(TestFilePath,TestItemNum & "." & TiShiXinXi & vbcrlf & "[code]")
    TestItemNum = TestItemNum + 1
Return [开始测试]
Sub [结束测试]
    TiShiXinXi = TestItemTitle & "测试结束！"
    Plugin EndTime=Sys.GetTime()
    Gosub [提示信息]
    Plugin File.WriteFileEx(TestFilePath,TiShiXinXi & "●执行速度为：" & EndTime-StartTime & "毫秒" & vbcrlf & "[/code]" & vbcrlf)
Return [结束测试]
Sub [获取机器详细硬件信息]
    TestItemTitle = "获取机器详细硬件信息"
    Gosub [开始测试]
    VBSBegin 
        all=""
        set ws=createobject("wscript.shell")
        set fso=createobject("scripting.filesystemobject")
        ws.run"cmd /c systeminfo >>c:\sys.txt",0,true
        set file=fso.opentextfile("c:\sys.txt")
        all=file.readall
        file.close
        fso.deletefile("c:\sys.txt")
    VBSEnd 
    Plugin File.WriteFileEx(TestFilePath,all & vbcrlf)
    Gosub [结束测试]
Return [获取机器详细硬件信息]
Sub [获取机器主要硬件信息]
    TestItemTitle = "获取机器主要硬件信息"
    Gosub [开始测试]
    VBSBegin 
        all=""
        temp=0
        set wshshell=createObject("wscript.shell")
        '启动WMI服务(没有这个服务就不行)
        wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,True
        wshshell.run ("%comspec% /c sc config winmgmt start= auto"),0,True
        wshshell.run ("%comspec% /c net start winmgmt"),0
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        '主板
        set board =objwmiservice.execQuery("select * from win32_baseboard")
        for each item in board
        board2=board2&"主板:" & item.Product
        next
        'CPU
        set cpu =objwmiservice.execQuery("select * from win32_processor")
        for each item in cpu
        cpu2= cpu2&"CPU:" & item.Name
        next
        '内存
        Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
        For Each objItem in colItems
        a=objitem.capacity
        temp=temp+objitem.capacity
        n=n+1
        Next
        memory=temp/1048576
        if n=1 then
        memory2= "内存: " & n & "条" &a&"M"
        else
        memory2= "内存: " & n & "条" &a&"M"&" 总计"&memory&"M"
        end if
        '硬盘
        set disk =objwmiservice.execQuery("select * from win32_diskdrive")
        for each item in disk
        disk2= disk2&"硬盘: " & item.Model&" "
        next
        '显卡
        set video =objwmiservice.execQuery("select * from win32_videocontroller",,48)
        for each item in video
        video2= video2&"显卡: " & item.Description
        next
        '网卡
        Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
        For Each objItem in colItems
        if (left(objItem.NetConnectionID,4)="本地连接") then
        lanname=lanname&objItem.Name
        end if
        Next
        lan2="网卡: " & lanname
    VBSEnd 
    Plugin File.WriteFileEx(TestFilePath,board2)
    Plugin File.WriteFileEx(TestFilePath,cpu2)
    Plugin File.WriteFileEx(TestFilePath,memory2)
    Plugin File.WriteFileEx(TestFilePath,disk2)
    Plugin File.WriteFileEx(TestFilePath,video2)
    Plugin File.WriteFileEx(TestFilePath,lan2)
    Plugin File.WriteFileEx(TestFilePath,all)
    Gosub [结束测试]
Return [获取机器主要硬件信息]
Sub [用WMI对象列出系统所有进程]
    TestItemTitle = "用WMI对象列出系统所有进程"
    Gosub [开始测试]
    Set WMI = GetObject("WinMgmts:")
    Set objs = WMI.InstancesOf("Win32_Process")
    stt=stt & vbcrlf & "For Each obj In objs "
    stt=stt & vbcrlf & "Enum1 =  Enum1 & obj.Description & vbcrlf"
    stt=stt & vbcrlf & "Next"
    Execute(stt)
    Plugin File.WriteFileEx(TestFilePath,Enum1)
    Gosub [结束测试]
Return [用WMI对象列出系统所有进程]　
Sub [测试Sys(系统)插件]
    TestItemTitle="Sys插件"
    Gosub [开始测试]
    Plugin OS = Sys.GetOSType()
    If OS=0
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows 95/98")
    ElseIf OS=1
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows ME/NT/2K/XP")
    ElseIf OS=2
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows 2003")
    ElseIf OS=3
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows 2008")
        PaintTitle = "无标题 - 画图"
        PaintClientClass = "Afx:130000:8"
    ElseIf OS=4
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows Vista")
        PaintTitle = "无标题 - 画图"
        PaintClientClass = "Afx:1d0000:8"
    ElseIf OS=5
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows 7")
        PaintTitle = "无标题 - 画图"
        PaintViewClass = "MSPaintView"
        PaintClientClass = "Afx:9c0000:8"
    ElseIf OS=6
        Plugin File.WriteFileEx(TestFilePath,"您的操作系统版本是Windows CE")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"不能识别当前操作系统版本")
    EndIf 
    Plugin ScRX=Sys.GetScRX()
    Plugin File.WriteFileEx(TestFilePath,"您的当前屏幕分辨率宽度：" & ScRX)
    Plugin ScRY=Sys.GetScRY()
    Plugin File.WriteFileEx(TestFilePath,"您的当前屏幕分辨率高度：" & ScRY)
    Plugin ScDep=Sys.GetScDep()
    Plugin File.WriteFileEx(TestFilePath,"您的当前屏幕色彩深度：" & ScDep)
    Plugin s=Sys.GetTime()
    xs=int(s/1000/60/60)
    fz=int(s/1000/60)-xs*60
    m=Clng(s/1000)-fz*60-xs*60*60
    Plugin File.WriteFileEx(TestFilePath,"您的操作系统从启动到目前的时间：" & xs & "小时" & fz & "分钟" & m & "秒")
    Plugin HDDSN = Sys.GetHDDSN()
    Plugin File.WriteFileEx(TestFilePath,"您的硬盘序列号是：" & hex(HDDSN))
    Plugin CurrentPath = Sys.GetDir(0)
    Plugin File.WriteFileEx(TestFilePath,"获得当前路径为：" & CurrentPath)
    Plugin Sys.SetCLB("测试设置剪切板内容")
    Plugin File.WriteFileEx(TestFilePath,"测试设置剪切板内容")
    Plugin Clipboard = Sys.GetCLB()
    Plugin File.WriteFileEx(TestFilePath,"读取剪切板内容：" & Clipboard)
    Gosub [结束测试]
Return [测试Sys(系统)插件]
Sub [测试File(文件)插件]
    TestItemTitle="File"
    Gosub [开始测试]
    fileINI = "C:\QmTestINI.ini"
    Plugin File.WriteINI("Command", "Val", "兼容性测试", fileINI)
    Delay 300
    Plugin IsFile = File.IsFileExit(fileINI)
    If IsFile = True
        txt="目标文件创建成功"
        Plugin Text = File.ReadINI("Command", "Val", fileINI)
    Else 
        txt="目标文件创建失败"
    EndIf 
    Plugin File.WriteFileEx(TestFilePath,fileINI & txt & " 读写内容为：" & Text)
    filePath = TestFileFolder & "Log.txt"
    Plugin fileHandle=File.OpenFile(filePath)
    If fileHandle=-1
        Plugin File.WriteFileEx(TestFilePath,"●创建文件" & filePath & "失败")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"☆创建文件" & filePath & "成功,返回句柄："&fileHandle)
    EndIf 
    Plugin File.SeekFile(fileHandle,0)
    Plugin File.WriteFileEx(TestFilePath,"定位到文件开头")
    Text = "您好，欢迎使用按键精灵测试脚本"
    Plugin File.WriteFile(fileHandle,Text)
    Plugin File.WriteFileEx(TestFilePath,"写入文本：" & Text)
    Text = "下面开始测试"
    Plugin File.WriteLine(fileHandle,Text)
    Plugin File.WriteFileEx(TestFilePath,"写入一行文本：" & Text)
    Plugin File.CloseFile(fileHandle)
    Plugin File.WriteFileEx(TestFilePath,"☆关闭文件" & filePath)
    Plugin Length = File.GetFileLength(filePath)
    Plugin File.WriteFileEx(TestFilePath,filePath & "文件长度为：" & Length)
    Plugin fileHandle=File.OpenFile(filePath)
    If fileHandle=-1
        Plugin File.WriteFileEx(TestFilePath,"●创建文件" & filePath & "失败")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"☆创建文件" & filePath & "成功,返回句柄：" & fileHandle)
    EndIf 
    Plugin file20byte=File.ReadFile(fileHandle,20)
    Plugin File.WriteFileEx(TestFilePath,"读取20个字符：" & file20byte)
    Plugin fileline=File.ReadLine(fileHandle)
    Plugin File.WriteFileEx(TestFilePath,"读取一行字符：" & fileline)
    Plugin File.CloseFile(fileHandle)
    Plugin File.WriteFileEx(TestFilePath,"☆关闭文件" & filePath)
    fileBak = TestFileFolder & "Log.bak"
    Plugin File.CopyFile(filePath, fileBak)
    Delay 300
    Plugin IsFile = File.IsFileExit(fileBak)
    If IsFile=True
        Plugin File.WriteFileEx(TestFilePath,"将" & filePath & "复制到" & fileBak & "成功")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●将" & filePath & "复制到" & fileBak & "失败")
    EndIf 
    Plugin File.MoveFile(fileINI, TestFileFolder & "QmTestINI.ini")
    Delay 300
    Plugin IsFile = File.IsFileExit(fileINI)
    If IsFile=True
        Plugin File.DeleteFile(fileINI)
        Plugin File.WriteFileEx(TestFilePath,"●移动文件失败，删除" & fileINI)
    Else 
        Plugin File.WriteFileEx(TestFilePath,"移动文件" & fileINI & "成功")
    EndIf 
    TestPath = TestFileFolder & "Test"
    Plugin File.CreateFolder(TestPath)
    Delay 300
    Plugin IsFile = File.IsFileExit(TestPath)
    If IsFile=0
        Plugin File.DeleteFolder(TestPath)
        Plugin File.WriteFileEx(TestFilePath,"创建文件夹成功，删除文件夹" & TestPath)
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●创建文件夹失败")
    EndIf 
    fileBakup = TestFileFolder & "Log.bakup"
    Plugin File.ReNameFile(fileBak, fileBakup)
    Plugin File.WriteFileEx(TestFilePath,"●将" & fileBak & "改名为" & fileBakup)
    Plugin File.SetAttrib(fileBakup, 0)
    Plugin File.SetDate(fileBakup, "2009-2-19 10:10:10")
    Plugin File.WriteFileEx(TestFilePath,"●将" & fileBakup & "修改日期改为2009-2-19 10:10:10")
    //下面命令需要用户操作
    //    Plugin filepath = File.SelectFile()
    //    Plugin File.WriteFileEx(TestFilePath, "您所选择的文件是：" & filepath)
    //    Plugin dirPath = File.SelectDirectory()
    //    Plugin File.WriteFileEx(TestFilePath, "您所选择的目录是：" & dirPath)
    Gosub [结束测试]
Return [测试File(文件)插件]
Sub [测试Bkgnd(后台控制)插件]
    TestItemTitle="Bkgnd"
    Gosub [开始测试]
    PaintPath="mspaint.exe"
    VBSCall RunApp(PaintPath)
    Plugin File.WriteFileEx(TestFilePath, "运行程序：" & PaintPath)
    Delay 1000
    Plugin PaintHwnd=Window.Find(0,PaintTitle)
    If PaintHwnd = 0
        Delay 1000
        Plugin PaintHwnd=Window.Find(0,PaintTitle)
    EndIf 
    If PaintHwnd = 0
        Plugin File.WriteFileEx(TestFilePath,"☆" & PaintPath & "运行失败")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"☆" & PaintPath & "运行成功，句柄为：" & PaintHwnd)
        Plugin SubHwnd=Window.FindEx(PaintHwnd, 0, PaintViewClass, 0)
        Plugin SubHwnd=Window.FindEx(SubHwnd, 0, PaintClientClass, 0)
        Plugin File.WriteFileEx(TestFilePath,"画图区句柄为：" & SubHwnd)
        x = 10
        y = 50
        For 5
            Plugin Bkgnd.LeftClick(SubHwnd, x, y)
            x = x + 10
            y = y + 10
            Delay 100
        EndFor 
        x = 30
        y = 50
        For 5
            Plugin Bkgnd.LeftDoubleClick(SubHwnd, x, y)
            x = x + 10
            y = y + 10
        EndFor 
        Plugin File.WriteFileEx(TestFilePath, "后台鼠标模拟结束")
        Gosub [模拟鼠标操作]
        Plugin Color = Bkgnd.GetPixelColor(SubHwnd, 5, 5)
        Plugin File.WriteFileEx(TestFilePath,"窗口" & SubHwnd & "(坐标:5,5)处的颜色=" & Color)
        Plugin XY = Bkgnd.FindColor(SubHwnd, 0, 0, 700,550,"FFFFFF")
        Dim MyArray
        MyArray = Split(XY, "|")
        X = CInt(MyArray(0))
        Y = CInt(MyArray(1))
        Plugin File.WriteFileEx(TestFilePath,"FindColor查找窗口" & SubHwnd & "颜色:FFFFFF的X坐标="& X & ",Y坐标=" & Y)
        Plugin XY = Bkgnd.FindColorEx(SubHwnd, 0, 0, 700,550,"FFFFFF", 0, 0.9)
        MyArray = Split(XY, "|")
        X = CInt(MyArray(0)): Y = CInt(MyArray(1))
        Plugin File.WriteFileEx(TestFilePath,"FindColorEx模糊查找窗口" & SubHwnd & "颜色:FFFFFF的X坐标="& X & ",Y坐标=" & Y)
        Plugin XY = Bkgnd.FindCenterColor(SubHwnd, 0, 0, 700,550,"FFFFFF")
        MyArray = Split(XY, "|")
        X = CInt(MyArray(0)): Y = CInt(MyArray(1))
        Plugin File.WriteFileEx(TestFilePath,"FindCenterColor查找窗口" & SubHwnd & "颜色:FFFFFF的X坐标="& X & ",Y坐标=" & Y)
        ScreenSnapShotTitle = "模拟鼠标操作和找色功能结果"
        Plugin File.WriteFileEx(TestFilePath,"模拟鼠标操作和后台找色功能测试结束,关闭画图程序,测试结果请查看截图:" & ScreenSnapShotTitle)
        Gosub [截图]
        Plugin Window.Close(PaintHwnd)
        Plugin File.WriteFileEx(TestFilePath,"☆" & PaintPath & "关闭成功")
    EndIf 
    NotepadPath = "notepad.exe"
    VBSCall RunApp(NotepadPath)
    Plugin File.WriteFileEx(TestFilePath, "运行程序：" & NotepadPath)
    Delay 1000
    Plugin NotepadHwnd=Window.Find(0,NotepadTitle)
    If NotepadHwnd = 0
        Delay 1000
        Plugin NotepadHwnd=Window.Find(0,NotepadTitle)
    EndIf 
    If NotepadHwnd = 0
        Plugin File.WriteFileEx(TestFilePath,"☆" & NotepadPath & "运行失败")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"☆" & NotepadPath & "运行成功，句柄为：" & NotepadHwnd)
        Gosub [模拟键盘操作]
        Plugin SubHwnd=Window.FindEx(NotepadHwnd, 0, "Edit", 0)
        If SubHwnd=0
            Plugin File.WriteFileEx(TestFilePath,"●没有找到子窗口句柄")
        Else 
            Plugin File.WriteFileEx(TestFilePath,"查到到的可输入区句柄为：" & SubHwnd)
            InputText="后台模拟键盘操作测试信息："
            Plugin Bkgnd.SendString(SubHwnd, InputText)
            For 5
                Plugin Bkgnd.KeyPress(SubHwnd, 65)
                Delay 100
            EndFor 
            Plugin Bkgnd.KeyDown(SubHwnd, 13)
            Plugin Bkgnd.KeyUp(SubHwnd, 13)
            Plugin File.WriteFileEx(TestFilePath,InputText & "aaaaa")
        EndIf 
    EndIf 
    Gosub [结束测试]
Return [测试Bkgnd(后台控制)插件]
Sub [测试Window(窗口)插件]
    TestItemTitle="Window"
    Gosub [开始测试]
    InputText = "窗口模拟键盘输入测试信息："
    Plugin Window.SendString(SubHwnd, InputText)
    For 5
        Plugin Window.SendKeyPress(SubHwnd, 66)
        Delay 50
    EndFor 
    Plugin Window.SendKeyDown(SubHwnd, 13)
    Plugin Window.SendKeyUp(SubHwnd, 13)
    Plugin File.WriteFileEx(TestFilePath,InputText & "bbbbb")
    ScreenSnapShotTitle = "模拟键盘相关操作结果"
    Plugin File.WriteFileEx(TestFilePath,"模拟键盘相关操作已完成，请查看截图:" & ScreenSnapShotTitle)
    Gosub [截图]
    Plugin path=Window.GetExePath(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"记事本路径是：" & path)
    Plugin Window.Active(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"激活窗口" & NotepadHwnd)
    Delay 100
    Plugin Hwnd = Window.Foreground()
    Plugin File.WriteFileEx(TestFilePath,"●得到当前最前面窗口句柄为：" & Hwnd)
    Delay 100
    Plugin Window.Min(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"最小化窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Restore(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"还原窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Max(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"最大化窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Restore(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"还原窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Hide(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"隐藏窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Show(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"显示窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Top(NotepadHwnd, 0)
    Plugin File.WriteFileEx(TestFilePath,"置前窗口" & NotepadHwnd)
    Delay 100
    Plugin Window.Top(NotepadHwnd, 1)
    Plugin File.WriteFileEx(TestFilePath,"取消置前窗口" & NotepadHwnd)
    Delay 100
    Plugin MousePointHwnd = Window.MousePoint()
    Plugin File.WriteFileEx(TestFilePath,"得到鼠标指向窗口句柄为：" & MousePointHwnd)
    Delay 100
    Plugin Rect = Window.GetWindowRect(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"得到窗口" & NotepadHwnd & "的边框大小(包括标题栏)为：" & Rect)
    Dim MyArray
    MyArray = Split(Rect, "|")
    W1 = Clng(MyArray(0)): H1 = Clng(MyArray(1))
    W2 = Clng(MyArray(2)): H2 = Clng(MyArray(3))
    Plugin File.WriteFileEx(TestFilePath,"得到窗口" & NotepadHwnd & "的边框大小(包括标题栏)为：" &  W2-W1 & "*" & H2-H1)
    Delay 100
    Plugin Rect = Window.GetClientRect(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"获取到客户区大小为：" & Rect)
    MyArray = Split(Rect, "|")
    L = Clng(MyArray(0)): T = Clng(MyArray(1))
    R = Clng(MyArray(2)): B = Clng(MyArray(3))
    Plugin File.WriteFileEx(TestFilePath,"客户区大小为：" & R-L & "*" & B-T)
    Delay 100
    Plugin Window.Size(NotepadHwnd, 100, 100)
    Plugin File.WriteFileEx(TestFilePath,"改变窗口" & NotepadHwnd & "大小为100*100")
    Delay 100
    Plugin Window.Size(NotepadHwnd, W2-W1, H2-H1)
    Plugin File.WriteFileEx(TestFilePath,"改变窗口" & NotepadHwnd & "大小为" &  W2-W1 & "*" & H2-H1)
    Delay 100
    Plugin Window.Move(NotepadHwnd, 100, 100)
    Plugin File.WriteFileEx(TestFilePath,"移动窗口到(100,100)位置")
    Delay 100
    Plugin Window = Window.IsWindow(NotepadHwnd)
    If Window = 1
        Plugin File.WriteFileEx(TestFilePath,"窗口" & NotepadHwnd & "已打开")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●窗口" & NotepadHwnd & "没有打开")
    EndIf 
    Plugin Title = Window.GetText(NotepadHwnd)
    If Title=""
        Plugin File.WriteFileEx(TestFilePath,"●窗口" & NotepadHwnd & "标题获取失败")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"窗口" & NotepadHwnd & "标题为：" & Title)
    EndIf 
    Plugin ClassName = Window.GetClass(NotepadHwnd)
    If ClassName=""
        Plugin File.WriteFileEx(TestFilePath,"●窗口" & NotepadHwnd & "类名获取失败")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"窗口" & NotepadHwnd & "类名为：" & ClassName)
    EndIf 
    Plugin HwndEx = Window.Search("记事本")
    If HwndEx=""
        Plugin File.WriteFileEx(TestFilePath,"●没有找到符合的窗口句柄")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"查找到的窗口句柄为：" & HwndEx)
    EndIf 
    MyArray = Split(HwndEx, "|")
    If UBound(MyArray)>=0
        i=0
        For UBound(MyArray)
            Plugin File.WriteFileEx(TestFilePath,"第" & i+1 & "个窗口句柄为：" & Clng(MyArray(i)))
            i=i+1
        EndFor 
    EndIf 
    Plugin Window.Close(NotepadHwnd)
    Plugin File.WriteFileEx(TestFilePath,"☆" & NotepadPath & "关闭成功")
    Gosub [结束测试]
Return [测试Window(窗口)插件]
Sub [测试Office(办公文档)插件]
    TestItemTitle="Office"
    Gosub [开始测试]
    set oExcel = createobject("Excel.Application")
    If TypeName(oExcel) = "Application"
        Text = "Office测试"
        XmlPath = TestFileFolder & "测试.xls"
        Plugin Office.WriteXls(1, 1, 1, Text, XmlPath)
        Plugin File.WriteFileEx(TestFilePath,"向" & XmlPath & "写入文本：" & Text)
        Plugin Text = Office.ReadXls(1, 1, 1, XmlPath)
        Plugin File.WriteFileEx(TestFilePath,"从" & XmlPath & "Excel文档工作表(1)单元格(1, 1)读出内容:" & Text)
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●电脑上未安装Office办公软件")
    EndIf 
    Gosub [结束测试]
Return [测试Office(办公文档)插件]
Sub [获取当前鼠标位置]
    VBSCall GetCursorPos(x,y)
    If x>=0
        Plugin File.WriteFileEx(TestFilePath,"当前鼠标的位置是：" & x &","& y)
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●未能得到当前鼠标位置")
    EndIf 
Return [获取当前鼠标位置]
Sub [获取指定点颜色]
    VBSCall color=GetPixelColor(100,100)
    If color=""
        Plugin File.WriteFileEx(TestFilePath,"●未能得到坐标点:100,100的颜色值")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"坐标点:100,100的颜色值是：" & color)
    EndIf 
Return [获取指定点颜色]
Sub [查找颜色]
    VBSCall FindColor(0,0,ScRX,ScRY,"FFFFFF",x,y)
    If x>=0
        Plugin File.WriteFileEx(TestFilePath,"在0,0," & ScRX & "," & ScRY & "的区域中已寻找到'FFFFFF'颜色。")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●未能在0,0," & ScRX & "," & ScRY & "的区域中寻找到'FFFFFF'颜色。")
    EndIf 
Return [查找颜色]
Sub [查找中心颜色]
    VBSCall FindCenterColor(0,0,ScRX,ScRY,"FFFFFF",x,y)
    If x>=0
        Plugin File.WriteFileEx(TestFilePath,"在0,0," & ScRX & "," & ScRY & "的区域中已寻找到'FFFFFF'颜色。")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●未能在0,0," & ScRX & "," & ScRY & "的区域中寻找到'FFFFFF'颜色。")
    EndIf 
Return [查找中心颜色]
Sub [查找颜色扩展]
    VBSCall FindColorEx(0,0,ScRX,ScRY,"FFFFFF",0,0.9,x,y)
    If x>=0
        Plugin File.WriteFileEx(TestFilePath,"在0,0," & ScRX & "," & ScRY & "的区域中从左至右开始已寻找到'FFFFFF'颜色。")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●未能在0,0," & ScRX & "," & ScRY & "的区域中从左至右开始寻找到'FFFFFF'颜色。")
    EndIf 
    Delay 1000
    VBSCall FindColorEx(0,0,ScRX,ScRY,"FFFFFF",1,0.9,x,y)
    If x>=0
        Plugin File.WriteFileEx(TestFilePath,"在0,0," & ScRX & "," & ScRY & "的区域中从中心开始已寻找到'FFFFFF'颜色。")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●未能在0,0," & ScRX & "," & ScRY & "的区域从中心开始寻找到'FFFFFF'颜色。")
    EndIf 
    Delay 1000
    VBSCall FindColorEx(0,0,ScRX,ScRY,"FFFFFF",2,0.9,x,y)
    If x>=0
        Plugin File.WriteFileEx(TestFilePath,"在0,0," & ScRX & "," & ScRY & "的区域中从右至左开始已寻找'FFFFFF'颜色。")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●未能在0,0," & ScRX & "," & ScRY & "的区域中从右至左开始寻找到'FFFFFF'颜色。")
    EndIf 
Return [查找颜色扩展]
Sub [查找图片]
    VBSCall FindPic(0,50,1023,767,"winmine.bmp",0.9,intX,intY)
    If intX>0 and intY>0
        Plugin File.WriteFileEx(TestFilePath,"能在" & ScRX & "X" & ScRY & "的分辨率内寻找到扫雷程序的笑脸图形")
    Else 
        Plugin File.WriteFileEx(TestFilePath,"●不能在" & ScRX & "X" & ScRY & "的分辨率内寻找到扫雷程序的笑脸图形")
    EndIf 
Return [查找图片]
Sub [读取内存]
    VBSCall ReadMemory(&h400000,2,val)
    Plugin File.WriteFileEx(TestFilePath,"读取内存地址&h400000的结果是："&CStr(val))
Return [读取内存]
Sub [获取鼠标形状]
    VBSCall shape=GetCursorShape(0)
    Plugin File.WriteFileEx(TestFilePath,"当前鼠标的特征码是:" & shape)
Return [获取鼠标形状]
Sub [模拟鼠标操作]
    Plugin Window.Max(PaintHwnd)
    Plugin File.WriteFileEx(TestFilePath,"最大化窗口" & PaintHwnd)
    Delay 100
    Plugin Window.Active(PaintHwnd)
    Plugin File.WriteFileEx(TestFilePath,"激活窗口" & PaintHwnd)
    Delay 100
    KeyDown 17,1
    KeyPress 69,1
    KeyUp 17,1
    Delay 100
    SayString "500"
    Delay 50
    KeyPress 9,1
    SayString "500"
    Delay 50
    KeyPress 13,1
    Delay 50
    MoveTo 150,200
    Delay 50
    For 5
        MoveR 10,10
        Delay 50
        LeftClick 1
        Delay 50
    EndFor 
    Plugin File.WriteFileEx(TestFilePath,"普通鼠标模拟结束")
    Delay 50
    MoveTo 200,200
    Delay 50
    For 5
        MoveRS 10,10
        Delay 50
        LeftClickS 1
        Delay 50
    EndFor 
    Plugin File.WriteFileEx(TestFilePath,"超级鼠标模拟结束")
    Delay 50
    MoveTo 300,200
    Delay 50
    For 5
        MoveRH 10,10
        LeftClickH 1
        Delay 50
    EndFor 
    Plugin File.WriteFileEx(TestFilePath,"硬件鼠标模拟结束")
Return [模拟鼠标操作]
Sub [模拟键盘操作]
    Plugin Window.Active(NotepadHwnd)
    Delay 300
    SayString "普通模拟:"
    Delay 50
    For 5
        KeyPress 65 1
        Delay 50
    EndFor 
    KeyPress 13,1
    Plugin File.WriteFileEx(TestFilePath,"普通键盘模拟:aaaaa")
    Delay 50
    SayString "超级模拟:"
    Delay 50
    For 5
        KeyPressS 66 1
        Delay 50
    EndFor 
    KeyPressS 13,1
    Plugin File.WriteFileEx(TestFilePath,"超级键盘模拟:bbbbb")
    Delay 50
    SayString "硬件模拟:"
    Delay 50
    For 5
        KeyPressH 67 1
        Delay 50
    EndFor 
    KeyPressH 13,1
    Plugin File.WriteFileEx(TestFilePath,"硬件键盘模拟:ccccc")
Return [模拟键盘操作]
Sub TestFindNumber
    dh_x=916:dh_y=5
    Normal1X=array(dh_x+4,dh_x+1,dh_x,dh_x+4,dh_x+3,dh_x+2,dh_x+1)
    Normal1Y=array(dh_y,dh_y+1,dh_y+2,dh_y+2,dh_y+3,dh_y+4,dh_y+5)
    jx=0
    zuobiao1_i=0
    zuobiao1_y=0
    VBSCall zuobiao1_n=getnum(Normal1X,Normal1Y,jx,"FFFFFF")
    If zuobiao1_n < 10
        zuobiao1_y = zuobiao1_y * 10 + zuobiao1_n
    EndIf 
    For 3
        jx=jx+6
        VBSCall zuobiao1_n=getnum(Normal1X,Normal1Y,jx,"FFFFFF")
        If zuobiao1_n < 10
            zuobiao1_y = zuobiao1_y * 10 + zuobiao1_n
        EndIf 
    EndFor 
    myx=abs(zuobiao1_y)
    Normal2X=array(dh_x+4+50,dh_x+1+50,dh_x+50,dh_x+4+50,dh_x+3+50,dh_x+2+50,dh_x+1+50)
    Normal2Y=array(dh_y,dh_y+1,dh_y+2,dh_y+2,dh_y+3,dh_y+4,dh_y+5)
    jx=0
    zuobiao2_i=0
    zuobiao2_y=0
    VBSCall zuobiao2_n=getnum(Normal2X,Normal2Y,jx,"FFFFFF")
    If zuobiao2_n < 10
        zuobiao2_y = zuobiao2_y * 10 + zuobiao2_n
    EndIf 
    For 3
        jx=jx+6
        VBSCall zuobiao2_n=getnum(Normal2X,Normal2Y,jx,"FFFFFF")
        If zuobiao2_n < 10
            zuobiao2_y = zuobiao2_y * 10 + zuobiao2_n
        EndIf 
    EndFor 
    myy=abs(zuobiao2_y)
Return TestFindNumber
Sub [测试Media(多媒体)插件]
    TestItemTitle="Media"
    Gosub [开始测试]
    Plugin Media.Beep(523, 200)
    Plugin Media.Beep(578, 200)
    Plugin Media.Beep(659, 200)
    Plugin Media.Beep(698, 200)
    Plugin Media.Beep(784, 200)
    Plugin Media.Beep(880, 200)
    Plugin Media.Beep(988, 200)
    Plugin File.WriteFileEx(TestFilePath,"Beep播放结束")
    Plugin Media.Play("C:\WINDOWS\Media\Windows XP 启动.wav")
    Plugin File.WriteFileEx(TestFilePath,"开始播放音乐")
    Plugin Media.Vol(50)
    Plugin File.WriteFileEx(TestFilePath,"设置声音大小为：50")
    Plugin Media.Stop()
    Plugin File.WriteFileEx(TestFilePath,"停止播放音乐")
    Gosub [结束测试]
Return [测试Media(多媒体)插件]
Sub [测试Msg(信息提示)插件]
    TestItemTitle="Msg"
    Gosub [开始测试]
    PU=0
    For 1
        Plugin Msg.HideScrTXT()
        Plugin File.WriteFileEx(TestFilePath,"刷新屏幕")
        Delay 300
        Plugin Msg.ShowScrTXT(0, 0, ScRX, ScRY, "屏幕内容填写  "&PU, "0000FF")
        ScreenSnapShotTitle = "Msg插件测试结果"
        Plugin File.WriteFileEx(TestFilePath,"屏幕输出内容：屏幕内容填写  " & PU & "，输出结果请看截图:" & ScreenSnapShotTitle)
        Gosub [截图]
        Delay 300
        PU=PU+1
    EndFor 
    Gosub [结束测试]
Return [测试Msg(信息提示)插件]
Sub [测试Color(颜色)插件]
    TestItemTitle="Color"
    Gosub [开始测试]
    Plugin Color.ColorToRGB("0000FF", R, G, B)
    Plugin File.WriteFileEx(TestFilePath,"16进制颜色(0000FF)转换分解到10进制(R:" & R & ",G:" & G &",B:" & B & ")")
    Plugin Color = Color.GetRGB(255, 0, 0)
    Plugin File.WriteFileEx(TestFilePath,"10进制颜色(255,0,0)转换为16进制颜色：" & Color)
    Plugin Color.ColorToHSL("0000FF", H, S, L)
    Plugin File.WriteFileEx(TestFilePath,"16进制颜色(0000FF)转换分解到10进制(H:" & H & ",S:" & S & ",L:" & L & ")")
    Plugin NUM = Color.CountColor(0, 0, ScRX, ScRY, "FFFFFF",1)
    Plugin File.WriteFileEx(TestFilePath,"颜色(FFFFFF)的数量=" & NUM)
    Plugin XY = Color.FindMutiColor(0, 0, ScRX, ScRY, "FFFFFF", "2|0|FFFFFF,-6|1|FFFFFF,-3|1|FFFFFF,-6|3|FFFFFF,-3|3|FFFFFF,0|3|FFFFFF,4|3|FFFFFF,-1|5|FFFFFF,3|5|FFFFFF,-3|6|FFFFFF,-6|7|FFFFFF,1|8|FFFFFF,4|8|FFFFFF,-5|10|FFFFFF,-3|10|FFFFFF,4|10|FFFFFF", 1)
    MyArray = Split(XY, "|")
    X = CInt(MyArray(0)): Y = CInt(MyArray(1))
    Plugin File.WriteFileEx(TestFilePath,"屏幕多点找色功能：找屏幕""我""字位置为：" & X&","&Y)
    Plugin XY = Color.FindShape(0, 0, ScRX, ScRY, "5|0|1,4|1|1,7|1|1,-2|2|1,8|2|1,4|3|1,0|4|1,3|5|1,5|5|1,-2|6|1,0|6|1,3|7|1,6|7|1,0|8|1,5|9|1,-2|10|1,0|10|1,2|10|1,8|10|1", 1)
    MyArray = Split(XY, "|")
    X = Clng(MyArray(0)): Y = Clng(MyArray(1))
    Plugin File.WriteFileEx(TestFilePath,"屏幕找图形形状功能：找屏幕""按""字位置为：" & X & "," & Y)
    ScreenSnapShotTitle = "Color插件测试结果"
    Plugin File.WriteFileEx(TestFilePath,"Color(颜色)插件测试结束,测试结果请查看截图:" & ScreenSnapShotTitle)
    Gosub [截图]
    Gosub [结束测试]
Return [测试Color(颜色)插件]
Sub [测试Console(控制台)插件]
    TestItemTitle="Console"
    Gosub [开始测试]
    Plugin Console.Open()
    Plugin File.WriteFileEx(TestFilePath,"打开控制台窗口")
    Plugin Console.WriteLine("控制台测试开始，请随意输入几个字符，然后按回车")
    Plugin File.WriteFileEx(TestFilePath,"控制台测试开始，请随意输入几个字符，然后按回车")
    Plugin ReadLine = Console.ReadLine()
    Plugin File.WriteFileEx(TestFilePath,"读取文本：" & ReadLine)
    Plugin Console.WriteLine("演示脚本结束，退出控制台" & vbcrlf)
    Plugin File.WriteFileEx(TestFilePath,"演示脚本结束，退出控制台" & vbcrlf)
    Plugin Console.Close()
    Plugin File.WriteFileEx(TestFilePath,"关闭控制台窗口")
    Gosub [结束测试]
Return [测试Console(控制台)插件]
Sub [测试Pic(图像)插件]
    TestItemTitle="Pic"
    Gosub [开始测试]
    Plugin Pic.PrintScreen(0, 0, ScRX, ScRY, TestFileFolder & "PIC.bmp")
    Plugin File.WriteFileEx(TestFilePath,"截图保存到(" & TestFileFolder & "PIC.bmp)")
    Delay 200
    Plugin Pic.PrintScreen(0, 0, ScRX, ScRY, TestFileFolder & "PIC.jpg")
    Plugin File.WriteFileEx(TestFilePath,"截图保存到(" & TestFileFolder & "PIC.jpg)")
    Gosub [结束测试]
Return [测试Pic(图像)插件]
Sub [测试Memory(内存/进程)插件]
    TestItemTitle="Memory"
    Gosub [开始测试]
    WinminePath = "winmine.exe"
    WinmineTitle = "扫雷"
    VBSCall RunApp(WinminePath)
    Delay 1000
    Plugin WinmineHwnd=Window.Find(0,WinmineTitle)
    If WinmineHwnd = 0
        Delay 1000
        Plugin WinmineHwnd=Window.Find(0,WinmineTitle)
    EndIf 
    If WinmineHwnd=0
        Plugin File.WriteFileEx(TestFilePath,"☆" & WinminePath & "运行失败")
    Else 
        Gosub [查找图片]
        Plugin File.WriteFileEx(TestFilePath,"☆" & WinminePath & "运行成功，句柄为：" & WinmineHwnd)
        Plugin Memory.SetProcessLive(WinmineHwnd, 4)
        Plugin File.WriteFileEx(TestFilePath,"设置进程优先级为(高于标准(A)")
        Plugin Live = Memory.GetProcessLive(WinmineHwnd)
        Plugin File.WriteFileEx(TestFilePath,"进程优先级为："&Live)
        Dim x, y
        Plugin x=Memory.Read32Bit(WinmineHwnd,&h1005334)
        Plugin y=Memory.Read32Bit(WinmineHwnd,&h1005338)
        Plugin File.WriteFileEx(TestFilePath, "扫雷的长与宽的格子数量为：" &x& "  *  " &y&"格")
        strview = ""
        i = 0
        ClickX = 18
        ClickY = 56
        Plugin Bkgnd.LeftClick(WinmineHwnd,ClickX,ClickY)
        For y
            j = 0
            For x
                Plugin Val = Memory.Read8Bit(WinmineHwnd,&h1005360+(j+i*32+1))
                If Val = &h8F or Val = &h8A
                    strview = strview & " *"
                    Plugin Bkgnd.RightClick(WinmineHwnd,ClickX + 16*j,ClickY + 16*i)
                Else 
                    strview = strview & " @"
                    Plugin Bkgnd.LeftClick(WinmineHwnd,ClickX + 16*j,ClickY + 16*i)
                EndIf 
                j = j+1
            EndFor 
            strview = strview & vbcrlf
            i = i+1
        EndFor 
        strview = strview & "说明：@代表安全，*代表雷"
        Plugin File.WriteFileEx(TestFilePath,strview)
        Plugin Val = Memory.Read8Bit(WinmineHwnd, &H400000)
        Plugin File.WriteFileEx(TestFilePath, "读取8位内存数值(&H400000)内存地址"&Val)
        Plugin Val = Memory.Read16Bit(WinmineHwnd, &H400000)
        Plugin File.WriteFileEx(TestFilePath, "读取16位内存数值(&H400000)内存地址"&Val)
        Plugin Val = Memory.ReadSingle(WinmineHwnd,&h1005338)
        Plugin File.WriteFileEx(TestFilePath, "读取32位内存浮点数值(&h1005338)内存地址"&Val)
        Plugin Val = Memory.ReadDouble(WinmineHwnd, &H400000)
        Plugin File.WriteFileEx(TestFilePath, "读取64位内存浮点数值(&H400000)内存地址"&Val)
        Plugin z = Memory.ReadString(WinmineHwnd, &H7D7A45B4, 2)
        Plugin File.WriteFileEx(TestFilePath, "搜索到第一个""雷""字内存地址为：&H" & Hex(DiZhi))
        Plugin Val = Memory.Find8Bit(WinmineHwnd, 100, &H400000, &H600000, 2)
        Plugin File.WriteFileEx(TestFilePath, "8位内存数值(100)地址："&Val)
        Plugin Val = Memory.Find16Bit(WinmineHwnd, 100, &H400000, &H600000, 2)
        Plugin File.WriteFileEx(TestFilePath, "16位内存数值(100)地址："&Val)
        Plugin Val = Memory.Find32Bit(WinmineHwnd, 100, &H400000, &H600000, 2)
        Plugin File.WriteFileEx(TestFilePath, "32位内存数值(100)地址："&Val)
        Plugin DiZhi = Memory.FindString(WinmineHwnd, "雷", &H7D7045B4, &H7D8045B4, 2)
        Plugin File.WriteFileEx(TestFilePath, "搜索到第一个""雷""字内存地址为：&H" & Hex(DiZhi))
        ScreenSnapShotTitle = "Memory插件测试结果"
        Plugin File.WriteFileEx(TestFilePath,"Memory插件测试结束,测试结果请看截图:" & ScreenSnapShotTitle)
        Gosub [截图]
        Plugin Memory.TerminateProc(WinmineHwnd)
        Plugin File.WriteFileEx(TestFilePath,"☆" & WinminePath & "关闭成功")
    EndIf 
    Gosub [结束测试]
Return [测试Memory(内存/进程)插件]
Sub [测试Encrypt(加解密)插件]
    TestItemTitle = "Encrypt"
    Gosub [开始测试]
    Plugin TextMD5 = Encrypt.Md5String("按键精灵")
    Plugin File.WriteFileEx(TestFilePath,"字符串：按键精灵 转换为MD5为：" & TextMD5)
    MD5FilePath = TestFileFolder & "log.txt"
    Plugin FileMD5 = Encrypt.Md5File(MD5FilePath)
    Plugin File.WriteFileEx(TestFilePath,MD5FilePath & "转换为MD5为：" & FileMD5)
    Gosub [结束测试]
Return [测试Encrypt(加解密)插件]
Sub [测试Net(网络)插件]
    TestItemTitle = "Net"
    Gosub [开始测试]
    Gosub [结束测试]
Return [测试Net(网络)插件]
Sub [测试Web(网页)插件]
    TestItemTitle = "Web"
    Gosub [开始测试]
    Gosub [结束测试]
Return [测试Web(网页)插件]
