安装脚本样例

AutoCAD 2008

 
安装脚本样例
 
 
 

本节中的样例脚本将在典型配置中安装程序。为了便于复制此样例脚本以及替换用户信息,所有变量项目使用相同的名称。日志文件名以所安装的产品为依据。可以在脚本中使用日志文件名,也可以将其更改为其他内容。

序列号前缀:123

序列号:12345678

姓氏:您的姓氏

名字:您的名字

组织:您的公司名

本程序静默安装的样例脚本使用本节所示的语法。

AutoCAD 2008 脚本安装

' AutoCAD 2008 脚本安装
option explicit
' 
' 创建变量 
dim x64bit
dim shell
dim productType
dim featuresToInstall
dim strADSKFirstName
dim strADSKLastName
dim strADSKOrganization
dim strADSKSercirity
dim strADSKSerialIsvalid
dim strADSKAccept
dim strADSKEula
dim strADSKReInstall
dim strADSKRemove
dim strADSKSNPrefix
dim strADSKSNNumber
dim strInstallLevel
dim strACADStandaloneNetworkType
dim strADSKLicenseServerType
dim strADSKLicenseType
dim strADSKServerFmtPath
dim strADSKServerPath
dim strADSKServerHostID
dim strADSKPath
dim strSourcePath
dim strAdditionalStuff
' 
' 脚本安装
Set shell = CreateObject("WScript.Shell")
x64bit = false ' 如果为 AutoCAD 2008 x64,则更改为 true
productType = "acad"
strInstallLevel=3 ' 5 完全安装 3 典型安装
' 
' 名称和组织信息 
strADSKFirstName = "Your First Name" 
strADSKLastName = "Your Last Name" 
strADSKOrganization = "Your Organization Name" 
' 
' 序列号信息 
strADSKSNPrefix = "123" 
strADSKSNNumber = "12345678" 
' 
' 安装源(例如,假设 D: 为安装介质) 
strSourcePath = "d:\" 
' 
' 安装目标 
strADSKPath = Shell.ExpandEnvironmentStrings("%ProgramFiles%") + "\AutoCAD 2008" 
' 
' 要安装的功能 
' ACS - AutoCAD 样例 
' CADStandards - CAD 标准 
' Database - 数据库 (DBCONNECT) 
' DCS - 设计中心样例 
' DigSig - 数字签名 
' Dictionaries - 词典 
' DrawingEncryption - 图形加密 
' Express_Tools - Express Tools 
' Fonts - 字体 
' Impression - “Autodesk Impression”工具栏(不包含在 64 位 AutoCAD 2008 中) 
' Materials - 材质库 
' Migrate - 移植自定义设置 
' NFW - 新功能专题研习 
' PLM - 许可证转移实用程序 
' RefMan - 参照管理器 
' System_Files - 	所需系统文件(在此脚本中默认安装) 
' TM - 纹理贴图 
' VBA - Visual Basic for Applications 
' VLS - Visual LISP 样例 
' VLT - Visual LISP 教程 
' 
' Sample is below - 请注意前导逗号 
featuresToInstall = ",DigSig,TM,CADStandards,Database,Dictionaries,DrawingEncryption,Express_Tools,Fonts,NFW,Migrate,RefMan,Samples,ACS,DCS,VBA,Materials,PLM,VLS,VLT" 
if not x64bit then 
' 在安装中添加 Autodesk Impression 
featuresToInstall = featuresToInstall & ",Impression" 
strAdditionalStuff = "ACADSHOWIMPR=" & """" & "1" & """" 
end if 
'''''' 取消注释安装的相关版本 - 默认为单机 
' 对于单机 
RunStandaloneInstall() 
' 
' 对于单一许可服务器
' RunSingleLicenseServerInstall() 
' 
' 对于冗余网络许可服务器 
' RunRedundantLicenseServerInstall() 
' 
' 对于分布式网络许可服务器 
' RunDistributedLicenseServerInstall() 
' 
' 脚本结束 
Wscript.quit() 
' 
Function RunStandaloneInstall 
shell.run DefaultCommand(),2,1 
end function 
' 
Function RunSingleLicenseServerInstall 
' 使用正确信息更新许可服务器
strACADStandaloneNetworkType = "3" 
strADSKLicenseServerType = "Single Server License" 
strADSKLicenseType = "Network License" 
strADSKServerPath = "myFlexServer" 
' HOSTID 或 MAC 地址 
strADSKServerHOSTID = "001122334455" 
' 
' 合并两个值 
strADSKServerPath = strADSKServerPath & " " & strADSKServerHOSTID 
shell.run MakeCommand(),2,1 
end function 
' 
Function RunRedundantLicenseServerInstall 
' 使用正确信息更新许可服务器
strACADStandaloneNetworkType = "3" 
strADSKLicenseServerType = "Redundant Server License" 
strADSKLicenseType = "Network License" 
' 
' 格式为 SERVERNAME1 MACADDR1 PORT1;SERVERNAME2 MACADDR2 PORT2; SERVERNAME3 MACADDR3 PORT3; - 冗余服务器仅允许 3 
strADSKServerPath = " myFlexServer 001122334455 27005; myFlexServer2 006622334455 27005;" 
shell.run MakeCommand(),2,1 
end function 
' 
Function RunDistributedLicenseServerInstall 
' 使用正确信息为许可服务器更新
strACADStandaloneNetworkType = "3" 
strADSKLicenseServerType = "Distributed Server License" 
strADSKLicenseType = "Network License" 
' 
' 格式为 @SERVERNAME1;SERVERNAME2;SERVERNAME3; 
strADSKServerPath = "@ myFlexServer;@ myFlexServer2;@ myFlexServer3;" 
' 
shell.run MakeCommand() & "ACAD_LICENSESERVER_DISTRIBUTED=1",2,1 
end function 
' 
Function DefaultCommand 
dim retString 
' /q 表示静默安装 ' /c [关键字] 替代参数表示关键字 
retString = strSourcePath & "\setup.exe /t /q /c " & productType & ": " 
retString = retString & "INSTALLDIR=" & """" & strADSKPath & """" & " " 
retString = retString & "ACADSERIALPREFIX=" & strADSKSNPrefix & " " 
retString = retString & "ACADSERIALNUMBER=" & strADSKSNNumber & " " 
retString = retString & "ACADFIRSTNAME=" & """" & strADSKFirstName & """" & " " 
retString = retString & "ACADLASTNAME=" & """" & strADSKLastName & """" & " " 
retString = retString & "ACADORGANIZATION=" & """" & strADSKOrganization & """" & " " 
retString = retString & "InstallLevel=" & strInstallLevel & " " 
' retString = retString & "ADSK_LAUNCH_MODE=Standalone" & " " 
if strInstallLevel = 3 then 
retString = retString & "ADDLOCAL=" & """" & "System_Files" & featuresToInstall & """" & " " 
end if 
retString = retString & strAdditionalStuff ' 专门用于 Impression 工具栏 
DefaultCommand = retString & " " 
end function 
' 
Function MakeCommand 
dim retString 
retString = DefaultCommand() & " " 
retString = retString & "ACADSTANDALONENETWORKTYPE=" & """" & strACADStandaloneNetworkType & """" & " " 
retString = retString & "ACADLICENSESERVERTYPE=" & """" & strADSKLicenseServerType & """" & " " 
retString = retString & "ACADLICENSETYPE=" & """" & strADSKLicenseType & """" & " " 
retString = retString & "ACADSERVERPATH=" & """" & strADSKServerPath & """" & " " 
MakeCommand = retString 
end function