Nauman,
Thanks that did it... I didn't even notice that, although I should have
after you pointed it out, I thought... the parenthesis add up... by why are
those semi-colon's there? it now makes sense, Thank you.
Randy Rush
"Nauman M" wrote in message
news:3ABB61E4.80DFAD45@email.com...
> see below
>
> Randy besides the learning , the code works as is. the setregistry and
> getregistry are just functions Rob wrote to easily read and write to
> current User registry. if you clip between the CUT's correctly, the code
> should work, but I figured what the problem is that the newreader is
> wrapping a line and instead of being one continuous, it is making it two
> separate the (itoa val1))) should be part of the commented PRINC line.
> so here is the updated code which should work.
>
> your answers are below
> ----------------CUT---------------------------
> ;;Rob Starz registry editing code
> (defun SetRegistry ( key Dword setting / )
> (vl-registry-write (strcat "HKEY_CURRENT_USER\\"
> (vlax-product-key)
> "\\Profiles\\"
> (getvar "cprofile")
> key ) Dword setting )
> )
>
> (defun GetRegistry ( key Dword / )
> (vl-registry-read (strcat "HKEY_CURRENT_USER\\"
> (vlax-product-key)
> "\\Profiles\\"
> (getvar "cprofile")
> key ) Dword )
> )
> ;;;Toggle Dimoverrides On/Off
> (defun C:DIMOVRTOGGLE ( / val1 val2)
> (setq val1 (getregistry "\\Preferences\\AecBase" "DwgSetupDoLispVars"))
> (setq val2 (getregistry "\\Preferences\\AecBase" "DwgSetupDoAcadVars"))
> (if (= val1 nil)
> (princ "You are not using ADT3")
> (progn
> (if (= val1 0)
> (progn
> (setregistry "\\Preferences\\AecBase" "DwgSetupDoLispVars" 1)
> (setregistry "\\Preferences\\AecBase" "DwgSetupDoAcadVars" 1)
> (princ "Dimension Overrides have been Turn On")
> );end progn
> (progn
> (setregistry "\\Preferences\\AecBase" "DwgSetupDoLispVars" 0)
> (setregistry "\\Preferences\\AecBase" "DwgSetupDoAcadVars" 0)
> (princ "Dimension Overrides have been Turn OFF")
> );end progn
> );end if
> );end progn
> );end if
> (princ)
> );;end
> ----------------CUT---------------------------
>
> Randy Rush wrote:
> >
> > Hey Nauman,
> >
> I clipped it into a lisp routine that always loads
> > with ADT, then assigned it to a menu drop down so i can just click on it
> > whenever... but all it does is give me the current registry value. I'm
> > looking at your code now and I can sort of follow it. Now for the
lesson...
> > correct me if I'm wrong... and I know this belongs in customization
but...
>
> Well the issue is that you have to restart ADT for the settin gto be in
> effect as it is read only at startup. so assigning it to the menu might
> be decieving that it does it instantly, which is not true.
>
> >
> > > (defun SetRegistry ( key Dword setting / )
> > Can follow this I think defining the function SetRegistry by writing to
the
> > current profile in the registry (although I got lost at the key Dword
> > setting... Question- What is that? I know it's a argument, I think...
>
> This is a registry write function, which writes it to the CURRENT
> PROFILE registry.
> the vl-registry-write function needs three arguments, the path, the
> VALUE, and the setting for the Value.
>
> in our case , the part of the path is being filled in by the
> vlax-product-key and (getvar "cprofile")
> and then I just supply the rest
> (setregistry "\\Preferences\\AecBase" "DwgSetupDoLispVars" 1)
> KEY DWORD setting
>
> i..e this would translate to on mycomputer,
>
HKEY_CURRENT_USER\\Software\\Autodesk\\Autocad\\12:409\\Nauman\\Preferences\
\AecBase
> and then I want to modeify DWGSETUPDOLispVars by setting its value to 1
>
> the Getregistry is the same, but it needs 2 arguments, as it is
> providing us with the setting in return.
>
> >
> >> or since your only defining the functions it doesnt really
> > matter?
>
> I am just definging the FUNCTIONS, I am not doing anything with it
> yet...
>
> >
> > > ;;;Toggle Dimoverrides On/Off..By Nauman Mysorewala
> > > ;;(princ (strcat "DwgSetupDoLispVars" (itoa val1) "DwgSetupDoAcadVars"
> > > (itoa val2))) <<<<<<<<<<<<<<<<<<<<<<<<,hey this should be commented
here as part of the (princ (strcat
> > > (if (= val1 nil)
> > > (princ "You are not using ADT3")
> > I'm assuming that somewhere in here the program is setting val1 to nil
which
> > is why I'm getting... This statement.
> by default any variable that you set in autocad autolisp is nil. i.e. in
> Autolisp you really do no define a variable the value of the variable
> tells autocad the type of the variable it is, unlike VBA where you have
> to specifically tell what type of variable it is and you define it
> before using it.
> and hence if you say on the command line of autocad
> (princ MYOWNSPECIALVARIABLE) it will print nil
> or for that matter anything.
> but if you say
> (setq MYOWNSPECIALVARIABLE 1)
> then this is an intger variable
> and should output 1
> (setq MYOWNSPECIALVARIABLE "1")
> will make it a string.
>
> Hope this helps!!
>
> sorry for the error, but the wrapping sometimes messes many things.
>
> -------------------
> Nauman M
> CAD Bazaar
> Need to easily Navigate to your Custom Content Folders?
> Need Autolayering for Dimensions without going through Design Center?
> Download the updated ADT Tools for ADT 2 & 3 at
> http://www.cadbazaar.com