对于那些仍然感兴趣的人,下面的代码将完成工作
我还想感谢基思在这件事上的帮助。
马克
- 'NOTE:
- 'AutoCAD must be closed in order for the paths to be updated in AutoCAD
- Dim WshShell,WshNetwork
- Dim curver, locale, cprofile
- Dim username
- Dim vname '= Value Name
- Dim vdata '= Value Data
- Set WshShell = WScript.CreateObject("WScript.Shell")
- Set WshNetwork = WScript.CreateObject("WScript.Network")
- username = WshNetwork.UserName
- vname = "SheetSetTemplatePath"
- 'This reads the currently installed and last accesed version of AutoCAD
- curver = WshShell.RegRead ( "HKCU\Software\Autodesk\AutoCAD\curver")
- 'There is an additional value under that registry key, it is unique and must be grabbed from here, or else you won't know the location of the profile
- locale = WshShell.RegRead ( "HKCU\Software\Autodesk\AutoCAD" & curver & "\curver")
- 'This Key holds only the current profile
- cprofile = WshShell.RegRead ( "HKCU\Software\Autodesk\AutoCAD" & curver & "" & locale & "\Profiles")
- 'New Path Goes Here
- vdata = "I:\Path\Template"
- 'Return to Default (Local) Path
- 'vdata = "C:\Documents and Settings"& Username &"\Local Settings\Application
- 'Data\Autodesk\Autodesk Land Desktop 2006\R16.2\enu\Template"
- 'Write The VName and VData (Support Path)
- WshShell.RegWrite "HKCU\Software\Autodesk\AutoCAD" & curver & "" & locale & "\Profiles" & cprofile & "\General" & vname,vdata
- 'Return The VName and VData (Support Paths)
- WScript.Echo "The Path for ValueName " & vname & " is" & VbCrLf & vdata
|