1291500406 发表于 2019-1-19 22:07:58

分享 -- 使用vbs语言加载 当前目录下的 lsp

本帖最后由 1291500406 于 2019-1-19 22:11 编辑

Public Sub Setup()
    On Error Resume Next
    Set objCAD = GetObject(, "AutoCAD.Application")
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set ws = CreateObject("WScript.Shell")
    path = fs.GetParentFolderName(wsh.ScriptFullName)
    menuPath = path + "\Sys\zhl.mns"
    ws.RegWrite "HKEY_LOCAL_MACHINE\Software\ZHL_SOFT\" _
            & "zhlpath", path
    Err.Clear
    Set app = GetObject(, "autocad.Application")
    If app.Documents.Count = 0 Then
      app.Documents.Add
    End If
    If Err.Number <> 0 Then
      MsgBox "必强提示您,没有发现正在运行中的AutoCAD,请先启动AutoCAD软件!", vbInformation, "必强提示您,请先启动AutoCAD软件!"
      CreateObject ("SAPI.SpVoice").Speak"必强提示您,请先启动AutoCAD软件"
      wsh.quit
    End If
    Set mgrp = app.MenuGroups
    Err.Clear
    Set ThisDrawing = objCAD.activedocument
    path = replace (path , "\" ,"/")
    ThisDrawing.SendCommand ("(load """ & path & "/必强工具箱.lsp"")" & vbCr)
                CreateObject ("SAPI.SpVoice").Speak"必强工具箱成功加载,谢谢使用"
End Sub
Setup
页: [1]
查看完整版本: 分享 -- 使用vbs语言加载 当前目录下的 lsp