1291500406 发表于 2019-1-19 22:20:00

分享 -- 使用vbs语言添加 lsp到自启动 CAD2007, 其他CAD调注册表位置

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

Dim WshShell, REG, Path, Key, SubKey, Value
Set WshShell = WScript.CreateObject("WScript.Shell")
'HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R17.0\ACAD-5001:409\Profiles\<<Unnamed Profile>>\Dialogs\Appload\Startup
Boot = "HKCU\"
Key = "Software\Autodesk\AutoCAD\"
Value = WshShell.RegRead(Boot & Key & "CurVer")
Key = Key & Value & "\"
Value = WshShell.RegRead(Boot & Key & "CurVer")
Key = Key & Value & "\"
SubKey = "Profiles\"
Value = WshShell.RegRead(Boot & Key & SubKey)
SubKey = SubKey & Value & "\Dialogs\Appload\Startup\"
Value = WshShell.RegRead(Boot & Key & SubKey)
IF Value<>"" Then
Set REG = GetObject("winmgmts:\\.\root\default:StdRegProv")
Item = Value & "Startup"
REG.GetStringValue &H80000001, Key & SubKey, Item, Value
If IsNull(Value) Then
    Value = ""
Else
    Value = WshShell.RegRead(Boot & Key & SubKey & Item)
    If UCase(Right(Value,9))<>"\必强工具箱.lsp" Then Value = ""
End If
End IF
IF Value<>"" Then
MsgBox "TB Tools 已在自动加载列表中!"
Else
Path = WshShell.CurrentDirectory & "\必强工具箱.lsp"
Value = WshShell.RegRead(Boot & Key & SubKey & "NumStartup")
Value = CStr(CInt(Value)+1)
WshShell.RegWrite Boot & Key & SubKey, Value, "REG_SZ"
WshShell.RegWrite Boot & Key & SubKey & "NumStartup", Value, "REG_SZ"
WshShell.RegWrite Boot & Key & SubKey & Value & "Startup", Path, "REG_SZ"
'HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R17.0\ACAD-5001:409\Applications\AcadAcLaunchNFW
Path = Boot & Key & "Applications\AcadAcLaunchNFW\LOADCTRLS"
Value = WshShell.RegRead(Path)
Value = Value or 2
WshShell.RegWrite Path, Value, "REG_DWORD"
MsgBox "欢迎使用必强工具箱,软件正在安装请稍后"
CreateObject ("SAPI.SpVoice").Speak"欢迎使用必强工具箱,软件正在安装请稍后"
End IF
Set objAutocadApp = Wscript.CreateObject("AutoCAD.Application")
objAutocadApp.Visible = True
Set thisdrawing=objautocadapp.activedocument
thisdrawing.SendCommand("_AP" & vbCr)


18157949415 发表于 2019-1-20 13:23:30

这是干啥呢?

1291500406 发表于 2019-1-20 15:22:52

18157949415 发表于 2019-1-20 13:23
这是干啥呢?

自动安装插件的

huxu823 发表于 2020-6-5 19:56:06

VBS语言批量安装LSP插件怎么搞

664571221 发表于 2024-2-28 20:48:28

1291500406 发表于 2019-1-20 15:22
自动安装插件的

强哥教教我
页: [1]
查看完整版本: 分享 -- 使用vbs语言添加 lsp到自启动 CAD2007, 其他CAD调注册表位置