• 设为首页
  • 收藏本站
  • 积分充值
  • VIP赞助
  • 手机版
  • 微博
  • 微信
    微信公众号 添加方式:
    1:搜索微信号(888888
    2:扫描左侧二维码
  • 快捷导航
    福建二哥 门户 查看主题

    vbs-toolkit VBSEdit 提供 免费的COM组件

    发布者: 皮3591 | 发布时间: 2025-8-14 03:02| 查看数: 33| 评论数: 0|帖子模式

    VBSCRIPT 语法简单 强大 但是功能上明显不足 需要第三方的控制 e.g. COM 组件来扩展其功能. VBSEDIT 安装完之后就可以在安装目录下发现 免费提供的 COM 组件 vbs toolkit.
    下载 VBSEDIT 工具
    32 位 DLL: vbsedit32 60 VBSEdit 提供
    64 位 DLL: vbsedit64 61 VBSEdit 提供
    注册组件
    注册组件需要管理员权限. 可以运行下面命令分别注册 32, 64 位的VBSEDIT 工具箱.
    1. regsvr32 vbsedit32.dll
    2. regsvr32 vbsedit64.dll
    复制代码
    注销的时候则需要 加 /u 参数
    1. regsvr32 /u vbsedit32.dll
    2. regsvr32 /u vbsedit64.dll
    复制代码
    提供了一些方便的功能扩展 比如剪贴板.
    1. Set toolkit = CreateObject("VbsEdit.Toolkit")
    2. toolkit.PutClipboardText "Hello World"
    3. WScript.Echo toolkit.GetClipboardText()
    复制代码
    CLIPBOARD OPERATIONS
    GetClipboardText method
    1、获取剪切板中的文本内容
    1. Set toolkit = CreateObject("VbsEdit.Toolkit")
    2. WScript.Echo toolkit.GetClipboardText()
    复制代码
    PutClipboardText method
    2、将指定内容设置到剪切板中
    1. Set toolkit = CreateObject("VbsEdit.Toolkit")
    2. toolkit.PutClipboardText "Hello World"
    复制代码
    运行后就将剪切板的数据设置为 Hello World
    DIALOG BOXES
    OpenFileDialog method
    Prompt the user to open a file
    toolkit.OpenFileDialog ([initialFolder,[filters,[multiselect,[title]]]])
    1. 'Opens a single file
    2. Set toolkit = CreateObject("VbsEdit.Toolkit")
    3. files=toolkit.OpenFileDialog("c:\scripts","Text Files (*.txt)|*.txt",False,"Open a text file")
    4. If UBound(files)>=0 Then
    5. WScript.Echo files(0)
    6. Else
    7. Wscript.Quit
    8. End If

    9. 'Opens multiple files
    10. Set toolkit = CreateObject("VbsEdit.Toolkit")
    11. files=toolkit.OpenFileDialog("c:\scripts","Text Files (*.txt)|*.txt",True,"Open a text file")
    12. If UBound(files)>=0 Then
    13. For Each filepath In files
    14.   WScript.Echo filepath
    15. Next
    16. Else
    17. Wscript.Quit
    18. End If
    复制代码
    上面的代码就是打开只可以输入一个文件的对话框,第二段就是可以选择多个文件的对话框
    SaveFileDialog method
    Prompt the user to save a file
    toolkit.SaveFileDialog ([initialFolder,[initialFilename,[filters,[title]]]])
    1. Set toolkit = CreateObject("VbsEdit.Toolkit")
    2. filepath = toolkit.SaveFileDialog("c:\scripts","test.txt","Text Files (*.txt)|*.txt")

    3. If Not(IsNull(filepath)) Then
    4. Set objFSO = CreateObject("Scripting.FileSystemObject")
    5. Set objFile = objFSO.CreateTextFile(filepath,True)
    6. objFile.WriteLine Date
    7. objFile.Close
    8. Else
    9. Wscript.Quit
    10. End If
    复制代码
    上面的代码就是另存为 文本文件对话框
    SelectFolder method
    Prompt the user to select a folder
    toolkit.SelectFolder ([initialDir,[title]])
    1. Set toolkit = CreateObject("VbsEdit.Toolkit")
    2. myfolder=toolkit.SelectFolder("c:\scripts","Please select a folder")

    3. If Not(IsNull(myfolder)) Then
    4. WScript.Echo myfolder
    5. Else
    6. Wscript.Quit
    7. End If
    复制代码
    上面的就是浏览文件夹对话框
    ENUMERATING WINDOWS
    TopLevelWindows method
    Enumerates top level windows
    1. Set toolkit = CreateObject("VbsEdit.Toolkit")
    2. For each window in toolkit.TopLevelWindows()
    3. WScript.Echo window.WindowTitle
    4. WScript.Echo window.ProcessId
    5. Next
    复制代码
    枚举顶级窗口
    Window object
    ClassName
    Retrieves the name of the class to which the specified window belongs.
    WindowTitle
    Retrieves the title of the specified window's title bar or the text of the control if the specified window is a control.
    DlgCtrlID
    Retrieves the identifier of the specified control.
    Height
    Retrieves the height of the specified window.
    Width
    Retrieves the width of the specified window.
    X
    Retrieves the X coordinate of the upper-left corner of the specified window.
    Y
    Retrieves the Y coordinate of the upper-left corner of the specified window.
    IsVisible
    Determines the visibility state of the specified window.
    ProcessId
    Retrieves the identifier of the process that created the specified window.
    Click method
    Sends a mouse click event to the specified window.
    window.Click ([offsetX ,[offsetY]])
    If offsetX and offsetY are not specified, the event is sent into the middle of the window.
    SendText method
    Sends text to the specified window.
    window.SendText text
    ChildWindows method
    Enumerates the child windows that belong to the specified parent window.
    –EOF (The Ultimate Computing & Technology Blog) —

    来源:互联网
    免责声明:如果侵犯了您的权益,请联系站长(1277306191@qq.com),我们会及时删除侵权内容,谢谢合作!

    最新评论

    浏览过的版块

    QQ Archiver 手机版 小黑屋 福建二哥 ( 闽ICP备2022004717号|闽公网安备35052402000345号 )

    Powered by Discuz! X3.5 © 2001-2023

    快速回复 返回顶部 返回列表