TheSwamp

CAD Forums => CAD General => Topic started by: ronjonp on April 07, 2004, 10:39:11 AM

Title: Append Registry
Post by: ronjonp on April 07, 2004, 10:39:11 AM
Code: [Select]
[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\ACAD-1:409\Profiles\WatermarkID\General]


"ACAD"=


The ACAD= already has search paths in it. How can I easily add a couple of paths?

Thanks,

Ron
Title: Append Registry
Post by: Keith™ on April 07, 2004, 12:31:06 PM
Registry changes won't take effect until you restart AutoCAD.
To make permanent changes to the registry path for future sessions of AutoCAD, retrieve the path value, add the new value to the end of the retrieved value, then put the new value in the registry.

To make changes that reflect only in the current drawing, and to make them immediate..
Change the acadprefix system variable.

to update drawing local support path in LISP

Code: [Select]

(setq acadpath (getvar "acadprefix"))
(setq acadpath (strcat acadpath ";" "new path"))
(setvar "acadprefix" acadpath)


To update the registry you should probably use the registry functions in VBA....

Code: [Select]

Function RegistryValue(ByVal RegistryKey As String, ByVal RegValue As Variant, ByVal ReadWriteDelete As Long, ByVal DataType As Long)
 Const VbRegDelete = 0
 Const VbRegRead = 1
 Const VbRegWrite = 2
 
 Dim WSHShell As IWshShell_Class
 Set WSHShell = Interaction.CreateObject("WScript.Shell")
 If ReadWriteDelete = VbRegRead Then
  GetRegistryValue = WSHShell.RegRead(RegistryKey)
 ElseIf ReadWriteDelete = VbRegWrite Then
  GetRegistryValue = WSHShell.RegWrite(RegistryKey, RegValue, DataType)
 ElseIf ReadWriteDelete = VbRegDelete Then
  GetRegistryValue = WSHShell.RegDelete(RegistryKey)
 End If
End Function


I am not sure about the data type of "DataType" I have not had the opportunity to research it.
Title: Append Registry
Post by: ronjonp on April 07, 2004, 12:38:02 PM
Thanks Keith! :D
Title: Append Registry
Post by: Keith™ on April 07, 2004, 12:43:46 PM
I edited the post, so you might want to reload it
Title: Re: Append Registry
Post by: danny on February 02, 2006, 04:02:34 AM
kieth,
if I'm using this lsp
Code: [Select]
(defun c:AHLCTBD ()
(setq prefs(vla-get-preferences (vlax-get-acad-object))
      filePrefs(vla-get-files prefs))
(vla-put-printerstylesheetpath filePrefs "M:\\_Cad Support\\AHL_CTB")
(vla-refreshplotdeviceinfo
  (vla-get-activelayout
   (vla-get-activedocument
     (vlax-get-acad-document))))
(alert "Notice:\nYou are now using AHL standard CTB's")
(princ)
)
What could I add to it so that the current drawing will read it.  Update the registry in current drawing?
 :-)