Jump to content

setenv and getenv used as a "protection"


manase

Recommended Posts

If i set a variable (setenv "variable1" "xyz") , will this variable stay in my computer (registry) after i uninstall autocad and then install it again? Stupid question, i suppose, but i'm waiting for a response ...:)

Thanks!

Edited by manase
Link to comment
Share on other sites

Since the environmental variables created using the setenv function are stored under the AutoCAD registry product key, specifically under:

(strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\FixedProfile\\General")

Then assuming that the AutoCAD uninstallation process correctly cleans up the registry, these keys should also be removed and would of course not be written when AutoCAD is reinstalled using its standard installation procedure.

Link to comment
Share on other sites

Any way to save (copy...) registry, to use them after an Autocad new installation? Or to save all environmental variables created using the setenv function ?

Link to comment
Share on other sites

Any way to save (copy...) registry, to use them after an Autocad new installation? Or to save all environmental variables created using the setenv function ?
No default way. You'd need to figure out what default registry entries there are before any custom ones, then you could do an Export in RegEdit. The setenv simply adds a registry key into that folder, in between all acad's default keys. It might be easier to program such through lisp though - use the vl-registry functions to search through that folder in a cleanly installed acad to find all the default keys saving to a text file. Then you can run a 2nd lisp to check all those keys on another PC to see which keys are not part of the default set, then you can save those to another file for future import.

 

Best practise (for future) would be to use the vl-registry functions instead and create a folder for your own customizations (separate from ADesk's registry folder). That way it would be a lot simpler to export only your custom settings through RegEdit. Or a half-way in between would be to use folders in the setenv function so your custom stuff are all grouped in a sub-folder under the acad general folder. It depends on what you're after (should the settings be acad version specific, then 2nd option is preferred).

Link to comment
Share on other sites

... assuming that the AutoCAD uninstallation process correctly cleans up the registry...

 

this.Mode = Modes.OffTopic;

 

You should see what was left over when I uninstalled the AutoCAD, Map, and Civil 3D 2014 Beta products with their new 'uninstaller' utility... Detestable really... So much so, that a VBScript was necessary to make it so I could even install the final AutoCAD 2014 product from ADN / Subscription after the Beta NDA expired.

Link to comment
Share on other sites

$ (vl-registry-write "HKEY_CURRENT_USER\\Test"

"" "test data")

"test data"

_$ (vl-registry-read

"HKEY_CURRENT_USER\\Test")

"test data"

 

 

This way i can create a registry folder - Test . Then, how can i use this folder for setenv function? All environmental variables created using the setenv function to be written here?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...