jpaulsen
2004-10-04, 08:42 PM
I would like to start by saying I know very little about VBA.
I am trying to update a program written for AutoCAD (LDT) 2002 for use in AutoCAD (LDT) 2005.
The program does several things; modifies the Autoexec.bat, modifies the sdsk.dfm file, modifies the acad.pgp and modifies the registry.
The code to modify the registry works in 2005 as it did in 2002. However, I am having trouble trying to edit some additional keys that were not being edited previously. I also want to know how to make a new key and then delete a key. I will explain the specifics below.
Modify a registry key
The following code modifies the Support File Search Path:
Set acadPref = ThisDrawing.Application.Preferences.Files
acadPref.SupportPath = "Z:\Land Desktop 2005\JRSupport;Z:\etc.
The registry key that holds this value is:
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop 2005\General\ACAD
How does SupportPath (program) relate to ACAD (registry key)?
Is there a list of “program keys” (for lack of the correct term) and the corresponding registry keys?
In particular I want to set the following:
§ acadPref.SheetSetTemplatePath = "Z:\Land Desktop 2005\JRTemplate"
§ acadPref.QnewTemplate = "Z:\Land Desktop 2005\JRTemplate\_jr settings.dwt"
§ acadPref.AlternativePageSetUpsTemplate = "Z:\Land Desktop 2005\JRTemplate\_jr settings.dwt"
§ acadPref.ToolPalettePath = "Z:\Land Desktop 2005\JRToolPalette;U:\Land Desktop 2005\Tool Palette"
§ acadPref.DefaultConfig = "Z:\Land Desktop 2005\Plotters\zAutodesk\PublishToWeb JPG.pc3"
These are listed with the registry key names as they appear in the registry. Coincidentally the ToolPalettePath line works but the other four return the following error:
Run-time error ‘438’: Object doesn’t support this property or method
Add a registry key
After doing some experimenting, it appears that the solution to my problem above answers this question. When I deleted the key;
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop 2005\General\ACAD
It is re-created when I run the program. So I guess all I need to know is the proper “program key”.
The keys that I want to add are:
§ HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop\General Configuration\ModeBits (Full time CRC validation)
§ HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop\General\HideSystemPrinters
Note: The full time CRC key is in General Configuration, not General. All the other keys listed in this post are under General. I am not sure how that path relates to acadPref.
Delete a registry key
At a later date I may decide to turn off Full time CRC validation. How would I delete the corresponding registry key?
Thanks in advance to anyone who took the time to read my very long post.
I am trying to update a program written for AutoCAD (LDT) 2002 for use in AutoCAD (LDT) 2005.
The program does several things; modifies the Autoexec.bat, modifies the sdsk.dfm file, modifies the acad.pgp and modifies the registry.
The code to modify the registry works in 2005 as it did in 2002. However, I am having trouble trying to edit some additional keys that were not being edited previously. I also want to know how to make a new key and then delete a key. I will explain the specifics below.
Modify a registry key
The following code modifies the Support File Search Path:
Set acadPref = ThisDrawing.Application.Preferences.Files
acadPref.SupportPath = "Z:\Land Desktop 2005\JRSupport;Z:\etc.
The registry key that holds this value is:
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop 2005\General\ACAD
How does SupportPath (program) relate to ACAD (registry key)?
Is there a list of “program keys” (for lack of the correct term) and the corresponding registry keys?
In particular I want to set the following:
§ acadPref.SheetSetTemplatePath = "Z:\Land Desktop 2005\JRTemplate"
§ acadPref.QnewTemplate = "Z:\Land Desktop 2005\JRTemplate\_jr settings.dwt"
§ acadPref.AlternativePageSetUpsTemplate = "Z:\Land Desktop 2005\JRTemplate\_jr settings.dwt"
§ acadPref.ToolPalettePath = "Z:\Land Desktop 2005\JRToolPalette;U:\Land Desktop 2005\Tool Palette"
§ acadPref.DefaultConfig = "Z:\Land Desktop 2005\Plotters\zAutodesk\PublishToWeb JPG.pc3"
These are listed with the registry key names as they appear in the registry. Coincidentally the ToolPalettePath line works but the other four return the following error:
Run-time error ‘438’: Object doesn’t support this property or method
Add a registry key
After doing some experimenting, it appears that the solution to my problem above answers this question. When I deleted the key;
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop 2005\General\ACAD
It is re-created when I run the program. So I guess all I need to know is the proper “program key”.
The keys that I want to add are:
§ HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop\General Configuration\ModeBits (Full time CRC validation)
§ HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-308:409\Profiles\Land Desktop\General\HideSystemPrinters
Note: The full time CRC key is in General Configuration, not General. All the other keys listed in this post are under General. I am not sure how that path relates to acadPref.
Delete a registry key
At a later date I may decide to turn off Full time CRC validation. How would I delete the corresponding registry key?
Thanks in advance to anyone who took the time to read my very long post.