明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1031|回复: 4

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

[复制链接]
发表于 2019-1-19 22:20 | 显示全部楼层 |阅读模式
本帖最后由 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)


"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2019-1-20 13:23 | 显示全部楼层
这是干啥呢?
 楼主| 发表于 2019-1-20 15:22 | 显示全部楼层

自动安装插件的
发表于 2020-6-5 19:56 | 显示全部楼层
VBS语言批量安装LSP插件怎么搞
发表于 2024-2-28 20:48 | 显示全部楼层

强哥教教我
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-19 16:53 , Processed in 0.288358 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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