[求助]宏的自动安装
您好:请教一下,我在做一个cad vba宏的自动安装程序,但需要在系统的支持搜索路径中添加C:\leo\files这个路径,不只应修改那个文件,在此文件中的哪里添加?
请多指教!!
谢谢!!
在注册表中添加
注册表的路径为:HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\ACAD-1:804\Profiles\<<Unnamed Profile>>\General,那儿有一个键值是ACAD,它保存的就是搜索路径。比如:ACAD="D:\\Program Files\\ACAD2000\\support;D:\\Program Files\\ACAD2000\\fonts;D:\\Program Files\\ACAD2000\\help;D:\\Program Files\\ACAD2000\\express;"上面要注意的R15.0这个跟版本有关系,不同版本是不一样的,而<<Unnamed Profile>>则是配置名称,也跟不同的配置有关系。
还有一种就是创建一个VB的应用程序,通过对Application对象的preferences引用,以程序的方式添加搜索路径。
后一种可能相对比较简单。
Sub Example_SupportPath()
' This example returns the current setting of
' SupportPath. It then changes the value, and finally
' it resets the value back to the original setting.
Dim preferences As AcadPreferences
Dim currSupportPath As String
Dim newSupportPath As String
Set preferences = ThisDrawing.Application.preferences
' Retrieve the current SupportPath value
currSupportPath = preferences.Files.SupportPath
MsgBox "The current value for SupportPath is " & currSupportPath, vbInformation, "SupportPath Example"
' Change the value for SupportPath
newSupportPath = "TestSupportPath"
preferences.Files.SupportPath = newSupportPath
MsgBox "The new value for SupportPath is " & newSupportPath, vbInformation, "SupportPath Example"
' Reset SupportPath to its original value
preferences.Files.SupportPath = currSupportPath
MsgBox "The SupportPath value is reset to " & currSupportPath, vbInformation, "SupportPath Example"
End Sub
页:
[1]