TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MeasureUp on July 04, 2013, 09:38:31 PM

Title: enviroment variable list
Post by: MeasureUp on July 04, 2013, 09:38:31 PM
Maybe this has been asked already.
I found a list in afralisp.net but I believe that is an old version and some of the E.V. are missing on the list. (for example "userdomain")
It would be much appreciated if you can tell me where to find an entire list of enviroment variables.
Title: Re: enviroment variable list
Post by: owenwengerd on July 04, 2013, 11:10:23 PM
_SHELL<enter><enter>SET<enter> to see them all.
Title: Re: enviroment variable list
Post by: irneb on July 05, 2013, 12:59:40 AM
Owen, that'll give all the Windows environment settings which ACad knows of.

For the others (acad specific) available through the Lisp getenv, you should also check acad's registry settings. Open RegEdit
Code: [Select]
WinKey+R
regedit<Enter>
Then browse to several of acad's registry paths. Note these examples are for ACA 2013, the version (R19.0), vertical (ACAD-B004:409) and profile (Profiles\AutoCAD) folders may differ depending on your acad and settings:
Code: [Select]
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.0\ACAD-B004:409\FixedProfile
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.0\ACAD-B004:409\Profiles\AutoCAD\General
There might also be others which are directly read through getenv.

Remember that unlike getvar, getenv requires you use the exact same capitalization. E.g. only (getenv "ACAD") will return the support paths, not (getenv "Acad") or (getenv "acad") or any other variant.

Also some new "user defined" sysvars are stored in
Code: [Select]
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.0\ACAD-B004:409\Variables
HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R19.0\ACAD-B004:409\Variables
HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.0\ACAD-B004:409\Profiles\AutoCAD\Variables
These you get through getvar instead of getenv.
Title: Re: enviroment variable list
Post by: Lee Mac on July 05, 2013, 06:18:12 AM
See here:

http://www.theswamp.org/index.php?topic=42884 (http://www.theswamp.org/index.php?topic=42884)
Title: Re: enviroment variable list
Post by: BlackBox on July 05, 2013, 12:29:10 PM
Remember that unlike getvar, getenv requires you use the exact same capitalization. E.g. only (getenv "ACAD") will return the support paths, not (getenv "Acad") or (getenv "acad") or any other variant.

Especially given that according to the Registry.GetValue (http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.getvalue.aspx) Method on MSDN:
Quote
...

Remarks

The string valueName is not case-sensitive.

...

... You'd think that the GetEnv LispFunction Method would not relegate users in this way.
Title: Re: enviroment variable list
Post by: MeasureUp on July 07, 2013, 08:59:42 PM
Thank you very much for to all for your input.
Lee's link does definitely help.
And to irneb, your tips do always help me to learn. With big thanks.
And big thanks to everyone.

By looking the registry folders I found that the locations of E.V. are slightly different between 2013 and 2014 versions.
Title: Re: enviroment variable list
Post by: huiz on July 08, 2013, 03:31:22 AM
Keep in mind that variables with the default setting are not saved into the Registry. Even if you set one once, after setting the default value are removed from Registry.

Here is a complete list, up to 2013 version: http://www.hyperpics.com/system_variables/

Also there is a complete command list as well and other information.
Title: Re: enviroment variable list
Post by: MP on July 08, 2013, 03:39:31 AM
System variables != Environment variables.
Title: Re: enviroment variable list
Post by: Kerry on July 08, 2013, 03:45:25 AM
also

Code - Scheme: [Select]
  1. (not (eq? System-variables Environment-variables))




Yes, I'm playing with scheme this week ...
Title: Re: enviroment variable list
Post by: irneb on July 08, 2013, 04:47:10 AM
See here:

http://www.theswamp.org/index.php?topic=42884 (http://www.theswamp.org/index.php?topic=42884)
A Lisp version of Gile's C# code going through the registry to see which are used in getenv:
Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun get-acad-regroots (/ )
  3.   (mapcar (function (lambda (root path) (strcat root ((eval path)))))
  4.           '("HKEY_LOCAL_MACHINE\\" "HKEY_CURRENT_USER\\")
  5.           (cond (vlax-machine-product-key '(vlax-machine-product-key vlax-user-product-key))
  6.                 ('(vlax-product-key vlax-product-key)))))
  7.  
  8. (defun unique-sorted-strlst (strlst / prev test)
  9.   (vl-remove-if (function (lambda (next)
  10.                             (cond ((setq test (eq next prev)))
  11.                                   ((setq prev next)))
  12.                             test))
  13.     (acad_strlsort strlst)))
  14.  
  15. (defun get-acad-envvars (/ read-envvars add-path)
  16.   (defun add-path (subkey) (strcat path "\\" subkey))
  17.   (defun read-envvars (path / )
  18.     (apply 'append (cons (vl-remove-if-not 'getenv (vl-registry-descendents path t))
  19.                          (mapcar 'read-envvars (mapcar 'add-path (vl-registry-descendents path))))))
  20.   (unique-sorted-strlst (apply 'append (mapcar 'read-envvars (get-acad-regroots)))))
Title: Re: enviroment variable list
Post by: irneb on July 08, 2013, 04:53:51 AM
also

Code - Scheme: [Select]
  1. (not (eq? System-variables Environment-variables))




Yes, I'm playing with scheme this week ...
:D More for this forum then:
Code - Auto/Visual Lisp: [Select]
  1. (/= System-variables Environment-variables)
Title: Re: enviroment variable list
Post by: huiz on July 08, 2013, 07:45:53 AM
System variables != Environment variables.

 :? Ah see it too now.

Monday morning, probably still processing the alcohol of the weekend (http://gfx.huiz.net/Smilies/drunk.gif)

Title: Re: enviroment variable list
Post by: MP on July 08, 2013, 10:33:22 AM
If in doubt play the "first coffee was a dud" card.