参照下面 *信*安装程序的vbs:
- On Error Resume Next
- Set objCAD = GetObject(, "AutoCAD.Application")
- If Err Then '如果AutoCAD应用程序启动失败,进行下面的处理
- Err.Clear
- MsgBox "必须先启动AutoCAD!" , vbInformation ,"【信·CAD】 <安装设置>"
- Else
- Set fs = CreateObject("Scripting.FileSystemObject")
- Set ws = CreateObject("WScript.Shell")
- Path = fs.GetParentFolderName(WScript.ScriptFullName)
- ws.RegWrite "HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\7Xin\7X_Menu\Path" ,_
- Path
- ws.Run "http://www.uushare.com/user/elitefish/file"
- Set fs = Nothing : Set ws = Nothing
- MsgBox "【信·CAD】 程序路径已经设定为:" _
- & vbLf &" " & Path & vbLf & vbLf _
- & "〖注意〗" _
- & vbLf & "如果文件夹更名或移动请再次运行本程序" , _
- vbInformation , "【信·CAD】 <安装设置>"
- Set ThisDrawing = objCAD.activedocument
- Path = replace (Path , "\" ,"/")
- ThisDrawing.SendCommand ("(load """ & Path & "/7X_Menu.vlx"")" & vbCr)
- ThisDrawing.SendCommand ("7X_MENU_HELP" & vbCr)
- End If
修改其中相关内容,将其保存为setup.vbs文件,放到程序目录,打开CAD,双击setup.vbs即可完成程序安装。 |