乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: Dnereb

使用VBScript设置AutoCAD路径

[复制链接]

6

主题

94

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2007-5-29 16:59:38 | 显示全部楼层

对于那些仍然感兴趣的人,下面的代码将完成工作
我还想感谢基思在这件事上的帮助。
马克
  1. 'NOTE:
  2. 'AutoCAD must be closed in order for the paths to be updated in AutoCAD
  3. Dim WshShell,WshNetwork
  4. Dim curver, locale, cprofile
  5. Dim username
  6. Dim vname  '= Value Name
  7. Dim vdata  '= Value Data
  8. Set WshShell = WScript.CreateObject("WScript.Shell")
  9. Set WshNetwork = WScript.CreateObject("WScript.Network")
  10. username = WshNetwork.UserName
  11. vname = "SheetSetTemplatePath"
  12. 'This reads the currently installed and last accesed version of AutoCAD
  13. curver = WshShell.RegRead ( "HKCU\Software\Autodesk\AutoCAD\curver")
  14. '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
  15. locale = WshShell.RegRead ( "HKCU\Software\Autodesk\AutoCAD" & curver & "\curver")
  16. 'This Key holds only the current profile
  17. cprofile = WshShell.RegRead ( "HKCU\Software\Autodesk\AutoCAD" & curver & "" & locale & "\Profiles")
  18. 'New Path Goes Here
  19. vdata = "I:\Path\Template"
  20. 'Return to Default (Local) Path
  21. 'vdata = "C:\Documents and Settings"& Username &"\Local Settings\Application
  22. 'Data\Autodesk\Autodesk Land Desktop 2006\R16.2\enu\Template"
  23. 'Write The VName and VData (Support Path)
  24. WshShell.RegWrite "HKCU\Software\Autodesk\AutoCAD" & curver & "" & locale & "\Profiles" & cprofile & "\General" & vname,vdata
  25. 'Return The VName and VData (Support Paths)
  26. WScript.Echo "The Path for ValueName " & vname & " is" & VbCrLf & vdata
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-7 22:35 , Processed in 1.073365 second(s), 53 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表