Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Contributor
SAPER59
Posts: 16
Registered: ‎04-15-2010
Message 1 of 3 (339 Views)

Setenv, getenv How to DELENV??

339 Views, 2 Replies
09-13-2012 06:58 AM

I need to erase a variable seted to the environment with SETENV, but not seting it to a value like "".

I need that when it is reading with GETENV, return a NIL value like when it wasn't exist after the first seting

 

Thanks in advance

Distinguished Contributor
patrick_35
Posts: 663
Registered: ‎06-01-2005
Message 2 of 3 (329 Views)

Re: Setenv, getenv How to DELENV??

09-13-2012 08:09 AM in reply to: SAPER59

Hi

For example

(defun delenv(env / cle)
  (setq cle (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\FixedProfile\\General"))
  (if (vl-registry-read cle env)
    (vl-registry-delete cle env)
  )
)

 
@+

*Expert Elite*
scot-65
Posts: 2,210
Registered: ‎12-11-2003
Message 3 of 3 (305 Views)

Re: Setenv, getenv How to DELENV??

09-13-2012 03:23 PM in reply to: SAPER59

If not mistaken, SETENV and GETENV accesses the registry keys established by the software.

By deleting these keys you are asking for trouble.

 

If you established keys using VL-REGISTRY-WRITE, and you SETVAR/SETENV using your

VL-REGISTRY-READ, deleting these keys will only corrupt your program, and not the software.

 

Be careful.

 

???

Scot-65
Dyslexia is a permanent physical disability that cannot be seen.
Introverts is proof that there is indeed intelligent life on this planet.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.