TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: T.Willey on October 11, 2006, 04:03:21 PM

Title: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 04:03:21 PM
I don't know how one would accomplish this, and thought it might be fun.  I will look into this a little more when I get back from lunch.
Title: Re: Challenge: Get all system variables with values
Post by: Guest on October 11, 2006, 04:15:41 PM
You mean besides....??


Quote
Command: setvar
Enter variable name or [?]: ?

Enter variable(s) to list <*>:

Then copy/paste.
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 11, 2006, 04:19:05 PM
(c:sysvdlg)

:)
Title: Re: Challenge: Get all system variables with values
Post by: Guest on October 11, 2006, 04:22:40 PM
Now what about the SETENV variables??  How does one obtain a list of those?!?  And are they the same for the various verticals??
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 04:49:09 PM
(c:sysvdlg)

:)
Pretty good, but it doesn't have them all.  There is no 'qaflags'.  I'm looking for them ALL.  :-)

Edit:
Now what about the SETENV variables??  How does one obtain a list of those?!?  And are they the same for the various verticals??
Good question.  I would like to know this answer also.

The detective work continues.
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 11, 2006, 04:52:19 PM
Edit the sysvdlg.dat file?

:)
Title: Re: Challenge: Get all system variables with values
Post by: uncoolperson on October 11, 2006, 04:59:20 PM
BRUTE FORCE

where list is ("AAA" "AAB" "AAC" etc...)
foreach item in list
if (getvar item) returns something
it's a var
if (getenv item) returns something
it's a var
if not
then it aint

Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 05:02:35 PM
Edit the sysvdlg.dat file?

:)
How about if you don't know what you are missing?  It doesn't look like it's in the 'atoms-family' which I must admit, I'm not sure about 'atom's to begin with.  I will continue to look around.

Thanks for pointing those out.  I did't even know about them.
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 05:03:39 PM
BRUTE FORCE

where list is ("AAA" "AAB" "AAC" etc...)
foreach item in list
if (getvar item) returns something
it's a var
if (getenv item) returns something
it's a var
if not
then it aint


Trying not to go that route.  Who knows how long that process would take?  How many letters would you make the sting limits be?
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 11, 2006, 05:11:47 PM
How about if you don't know what you are missing?

Good question and I don't know. I'm guessing it's internal (in the AutoCAD executable, though that is pure speculation).

It doesn't look like it's in the 'atoms-family' which I must admit, I'm not sure about 'atom's to begin with.  I will continue to look around.

You're right about the atoms-family, it doesn't host the system variables. On that topic, you may find the tool in this (http://www.theswamp.org/index.php?topic=1445.0) thread interesting / useful / not.

Thanks for pointing those out.  I did't even know about them.

No problem My pleasureTim.

Edit: My wife says "No problem" all the time because everyone at her work says that and I can't stand it. Can't believe I just posted same. Carry on.

:)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 05:23:46 PM
You're right about the atoms-family, it doesn't host the system variables. On that topic, you may find the tool in this (http://www.theswamp.org/index.php?topic=1445.0) thread interesting / useful / not.
Very cool routine!  I'm not all up on atoms, so it may be over my head right now, but I can see some good things with it.

No problem My pleasureTim.

Edit: My wife says "No problem" all the time because everyone at her work says that and I can't stand it. Can't believe I just posted same. Carry on.

:)
I know what you mean.  I've been trying to kick the habbit of saying it also.  When people say 'thank you' and I respond with 'no problem' instead of 'you're welcome' or something, I'm just like 'why did I say that'  :-D oh well.  I will learn soon enough.

Thanks again Michael.
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 11, 2006, 05:42:04 PM
My bright idea :-o?
You could set up a lisp with this:
Code: [Select]
;;  Check all words "aaaa" through "zzzzzzzzzzzzzzz"
(defun c:getvars ()
  (setq seed "aaaa")
  (while (< (strlen seed) 15)
    (if (setq var (getvar seed))
      (setq vlist (cons seed vlist))
    )
    ;; Here you will need to increment the string
    ;; Going through all carbonations, then add a character.
    ;;  too tired to do it though, it's beer 30
  ) ; while
  vlist
)
Title: Re: Challenge: Get all system variables with values
Post by: LE on October 11, 2006, 05:42:44 PM
I am doing some laundry work right now (so no time to play)....   :-P - I think that the master of master John Uhden did something like this.... it may still be available on his web site...
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 05:52:30 PM
Alan,

 I have code I might be able to use to do it this way, I was just hoping that it was stored somewhere in the system, and could be retrived easly.  Doesn't look like it.

Luis,

  I didn't see anything on his side cadlantic.com (http://www.cadlantic.com).
Title: Re: Challenge: Get all system variables with values
Post by: LE on October 11, 2006, 06:12:11 PM
Can't find the code... but found a partial output from something he wrote (I remember seeing the code - man the age  :oops:)

http://discussion.autodesk.com/thread.jspa?messageID=2129722
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 11, 2006, 06:59:54 PM
I will look for a better way.  Here is a brute force coded way.  I have one working right now that will go up to 15 letters, don't know how long it will take, it's in a spare Acad right now running.
Code: [Select]
(defun c:GetSysVars (/ Str VarList)
; Returned with only going up to "AAAAA"
; (("DATE" . 2.45402e+006) ("CTAB" . "Layout1") ("AREA" . 0.0) ("SDI" . 0))

(defun UpStringLetters (String Location)

(cond
 ((equal Location 0)
  (strcat "A" String)
 )
 ((= (substr String Location 1) "Z")
  (UpStringLetters
   (strcat
    (substr String 1 (1- Location))
    "A"
    (substr String (1+ Location))
   )
   (1- Location)
  )
 )
 ((equal (strlen String) 1)
  (chr (1+ (ascii String)))
 )
 (T
  (strcat
   (substr String 1 (1- Location))
   (chr (1+ (ascii (substr String Location 1))))
   (substr String (1+ Location))
  )
 )
)
)
;------------------------------------------------------------
(setq Str "AAA")
(while (< (strlen Str) 16)
 (if (getVar Str)
  (setq VarList (cons (cons Str (getvar Str)) VarList))
 )
 (setq Str (UpStringLetters Str (strLen Str)))
)
VarList
)
Title: Re: Challenge: Get all system variables with values
Post by: kpblc on October 12, 2006, 01:06:13 AM
acadinfo ?
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 12, 2006, 07:47:40 AM
That's very interesting. :-)
Thanks kpblc
Title: Re: Challenge: Get all system variables with values
Post by: daron on October 12, 2006, 08:55:52 AM
This is what I got:
Quote
Initializing...

ACADINFO is a utility for gathering information about
your AutoCAD installation and current setup. The
routine will examine your system and write a text file
called "acadinfo.txt" to your hard drive.
Press ENTER to continue or ESC to cancel...


Examining your AutoCAD setup. Please wait...
Performing load tests...bad argument type: stringp nil
Title: Re: Challenge: Get all system variables with values
Post by: Guest on October 12, 2006, 09:06:23 AM
I got a 284KB text file... most of which I can't understand (damn vla-blah blah blah blah).

I suppose if I understood it, it would make more sense.  Kinda interesting little program though.  It spit out EVERYTHING you could imagine; even the variables of my home-grown programs!
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 12, 2006, 09:09:05 AM
See my output file attached.
Title: Re: Challenge: Get all system variables with values
Post by: kpblc on October 12, 2006, 09:27:12 AM
Code: [Select]
Command: acadinfo
Initializing...


ACADINFO is a utility for gathering information about
your AutoCAD installation and current setup. The routine
will examine your system and write a text file called
'D:\acadinfo.txt'
to your hard drive.
Press ENTER to continue or ESC to cancel...


Examining your AutoCAD setup. Please wait...
Performing load tests...
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.

Writing AutoCAD system variable information...
Formatting and writing ouput. Please wait...-

Output written to: "D:\acadinfo.txt"
Done.
My result in in attached file.
> daron : it seems strange. Sometimes et-functions returns errors. In this case try to reinstall them.
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 12, 2006, 09:53:17 AM
 Just tested in AK2, AK4 & AK6. AK2 uses a 1999 acadinfo.lsp while AK4 & AK6 have a 2002 version of acadinfo.lsp on my system.
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 12, 2006, 10:06:24 AM
If you examine acadinfo.lsp, which isn't written particularly well, you'll see that the sysvars are hard coded, and that's not what I think Tim is looking for. If I understand his posts he's looking for a way to query AutoCAD / "The System" and have it ante up all the variables, ergo the brute force program he's currently running.

:)

No problem My pleasureTim.

Edit: My wife says "No problem" all the time because everyone at her work says that and I can't stand it. Can't believe I just posted same. Carry on.:)

I know what you mean.  I've been trying to kick the habbit of saying it also.  When people say 'thank you' and I respond with 'no problem' instead of 'you're welcome' or something, I'm just like 'why did I say that'  :-D oh well.  I will learn soon enough.

Thanks again Michael.

You're most welcome Tim.

:)
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 12, 2006, 10:09:39 AM
PS: That's not to say there isn't value in using acadinfo.lsp; just saying I don't think it meets Tim's requirements.

:)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 12, 2006, 11:24:32 AM
acadinfo ?
Thanks, but I get the same error that Daron gets when trying it, and if it is hard coded like Michael said (not reason not to believe him) then that isn't what I was looking for.  They might not have all the system variables in there to begin with, so one wouldn't get a full list.

So I changed my code to write a text file instead, so I left it on last night, and when I got here this morning, IT WAS STILL RUNNING.  Here is the output of the text file.  I will run it again tonight when I leave.

Edit: Use code tags instead of quote tags.  Got smilies.
Edit: Was run in Acad 07
Code: [Select]
("SDI" . 0)
("AREA" . 0.0)
("CTAB" . "Layout1")
(DATE . 2.45402e+006)
(APBOX . 0)
(BACKZ . 0.0)
(CDATE . 2.0061e+007)
(DBMOD . 5)
(DIMTM . 0.0)
(DIMTP . 0.0)
(ERRNO . 93)
(GFANG . 0.0)
(GRIPS . 1)
(HPANG . 0.0)
(SURFU . 6)
(SURFV . 6)
(UCSVP . 1)
(VSMAX . (7379.14 4320.0 0.0))
(VSMIN . (-5606.58 -2880.0 0.0))
(VTFPS . 7)
(XEDIT . 1)
(AFLAGS . 16)
(ANGDIR . 0)
(ATTDIA . 0)
(ATTREQ . 1)
(AUNITS . 0)
(AUPREC . 8)
(BVMODE . 0)
(CLAYER . 0)
(CMDDIA . 1)
(COORDS . 1)
(CVPORT . 2)
(DELOBJ . 1)
(DIMALT . 0)
(DIMASO . 1)
(DIMASZ . 0.09375)
(DIMBLK . )
(DIMCEN . 0.0)
(DIMDEC . 2)
(DIMDLE . 0.0625)
(DIMDLI . 0.0625)
(DIMEXE . 0.0625)
(DIMEXO . 0.0625)
(DIMFIT . 5)
(DIMFXL . 1.0)
(DIMGAP . 0.0625)
(DIMLIM . 0)
(DIMLWD . -2)
(DIMLWE . -2)
(DIMRND . 0.0)
(DIMSAH . 0)
(DIMSHO . 1)
(DIMTAD . 0)
(DIMTIH . 0)
(DIMTIX . 0)
(DIMTOH . 0)
(DIMTOL . 0)
(DIMTSZ . 0.0)
(DIMTVP . 0.0)
(DIMTXT . 0.125)
(DIMUPT . 0)
(DIMZIN . 12)
(DRAGVS . )
(EXPERT . 0)
(EXTMAX . (-1.0e+020 -1.0e+020 -1.0e+020))
(EXTMIN . (1.0e+020 1.0e+020 1.0e+020))
(FRONTZ . 0.0)
(GFNAME . 1)
(GTAUTO . 1)
(HPNAME . ANSI31)
(LIMMAX . (2016.0 1440.0))
(LIMMIN . (0.0 0.0))
(LOCALE . ENU)
(LOCKUI . 0)
(LUNITS . 4)
(LUPREC . 8)
(NOMUTT . 0)
(OSMODE . 4133)
(OSNAPZ . 0)
(PDMODE . 0)
(PDSIZE . 0.0)
(POPUPS . 1)
(SKPOLY . 0)
(TARGET . (0.0 0.0 0.0))
(UCSORG . (0.0 0.0 0.0))
(ACADVER . 17.0s (LMS Tech))
(ANGBASE . 0.0)
(APSTATE . 0)
(ATTMODE . 1)
(AUXSTAT . 0)
(CECOLOR . BYLAYER)
(CELTYPE . ByLayer)
(CMDECHO . 0)
(CMLJUST . 0)
(COMPASS . 0)
(CSHADOW . 0)
(DCTCUST . C:\Documents and Settings\a0kcdzz\Application Data\Autodesk\AutoCAD 2007\R17.0\enu\support\sample.cus)
(DCTMAIN . enu)
(DIASTAT . 1)
(DIMADEC . 0)
(DIMALTD . 2)
(DIMALTF . 25.4)
(DIMALTU . 2)
(DIMALTZ . 0)
(DIMAZIN . 0)
(DIMCLRD . 0)
(DIMCLRE . 0)
(DIMCLRT . 0)
(DIMDSEP . .)
(DIMFRAC . 0)
(DIMJUST . 0)
(DIMLFAC . 1.0)
(DIMPOST . )
(DIMSOXD . 0)
(DIMTDEC . 2)
(DIMTFAC . 1.0)
(DIMTOFL . 1)
(DIMTOLJ . 1)
(DIMTZIN . 0)
(DIMUNIT . 2)
(DONUTID . 0.5)
(DONUTOD . 1.0)
(DRSTATE . 0)
(DTEXTED . 2)
(DWGNAME . Drawing2.dwg)
(DYNMODE . 0)
(ENTEXTS . 1)
(ENTMODS . 9)
(ERSTATE . 1)
(FILEDIA . 1)
(FONTALT . simplex.shx)
(FONTMAP . C:\Documents and Settings\a0kcdzz\Application Data\Autodesk\AutoCAD 2007\R17.0\enu\support\acad.fmp)
(GFSHIFT . 0)
(GRIPHOT . 1)
(HALOGAP . 0)
(HANDLES . 1)
(HPASSOC . 1)
(HPBOUND . 1)
(HPSCALE . 1.0)
(HPSPACE . 1.0)
(INSBASE . (0.0 0.0 0.0))
(INSNAME . )
+++ Error! Last string evaluated was JPHWKJQ +++
Title: Re: Challenge: Get all system variables with values
Post by: daron on October 12, 2006, 01:21:21 PM
Quote
I suppose if I understood it, it would make more sense.  Kinda interesting little program though.  It spit out EVERYTHING you could imagine; even the variables of my home-grown programs!
I think the "home-grown" comment might be where the real culprit is. I have a few that I have yet to discover what's wrong with them, so I'm sure it errored out with that.
Title: Re: Challenge: Get all system variables with values
Post by: JohnK on October 12, 2006, 06:39:40 PM
*blink blink* WOW. This sounds like something that could be fun. *hummmm*
[Se7en: Nods to the others, turns and walks away.]
[Se7en: Has left]
Title: Re: Challenge: Get all system variables with values
Post by: Guest on October 13, 2006, 10:57:12 AM
So whadja get Tim??  Did you run it last night??

Just curious to find out what Autodesk is trying to hide. :)
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 13, 2006, 11:04:20 AM
Tim,
Looks like you need to change the way empty strings are output.
Code: [Select]
(DIMBLK . )  -----> (DIMBLK . "")I can run it on 2006 if you want to compare or maybe you have 6 still.
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 13, 2006, 11:50:59 AM
Sorry.  :cry:
Forgot to run it last night.  I can run it over the weekend and see what I get when I come back on Monday.  I have '06 still, so I can run it on both, and see what they return.

Tim,
Looks like you need to change the way empty strings are output.
Code: [Select]
(DIMBLK . )  -----> (DIMBLK . "")I can run it on 2006 if you want to compare or maybe you have 6 still.
Alan,
 This is how the code looks
Code: [Select]
(write-line (vl-princ-to-string (cons Str (getvar Str))) Opened)I guess I can make it a little better, and see if getvar returned an empty string.  Maybe something like
Code: [Select]
(write-line
 (strcat
  "("
  Str
  (if (= (getvar Str) "")
   "\"\""
  (vl-princ-to-string (getvar Str))
  ")"
 )
 Opened
)
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 13, 2006, 01:13:43 PM
You could try this: :-)
Code: [Select]
(print (cons Str (getvar Str)) Opened)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 13, 2006, 01:38:07 PM
You could try this: :-)
Code: [Select]
(print (cons Str (getvar Str)) Opened)
Didn't like that.  Here is the error
Quote
Error--> bad argument type: stringp ("DATE" . 2.45402e+006)
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 13, 2006, 01:50:02 PM
Just tested this in ACAD2000 & worked fine :?
Code: [Select]
(defun c:test (/ str)
  (setq fn (open "C:\\abc.txt" "w"))
  (setq str "dimblk")
  (print (cons Str (getvar Str)) fn)
  (setq str "date")
  (print (cons Str (getvar Str)) fn)
  (setq str "osmode")
  (print (cons Str (getvar Str)) fn)
  (close fn)
  (startapp "notepad.exe" "C:\\abc.txt")
  (princ)
)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 13, 2006, 01:57:23 PM
I was just about to say I made a stupid mistake, and that you are correct and works beautifully.  :-)

What I did was leave the 'write-line' and just add a 'print' to it, so it looked like
Code: [Select]
(write-line (print (cons Str (getvar Str))) Opened)Once I coded it correctly it worked like a charm.

Two things in two days you have thought me now.  Take the next two days off.  Thanks Alan.
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 13, 2006, 02:12:42 PM
Thank you sir.
I may just do that, take the next 2 days off. :)
We'll continue to learn from each other, keep up the good work. 8-)
Title: Re: Challenge: Get all system variables with values
Post by: Crank on October 15, 2006, 06:16:18 AM
Just a remark: If you only try the alphabeth, then variables like *_TOOLPALETTEPATH won't be in the list.
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 16, 2006, 11:16:12 AM
Just a remark: If you only try the alphabeth, then variables like *_TOOLPALETTEPATH won't be in the list.
You are correct, and I didn't think of this, but this way does not seem to be the right way of doing it.  My system did have some messages when I got in this morning, so it might not have ran all weekend long, but still, there has to be a better way.  After running it returned these two files.  One for 06 (electrical) and one for 07 (vanilla).  The last line in each file was cause by me this morning, escaping out of the commands.

'06 last two lines
Code: [Select]
("XREFCTL" . 0)
+++ Error! Last string evaluated was XSZSMIE +++
'07 last two lines
Code: [Select]
("QCSTATE" . 0)
+++ Error! Last string evaluated was QZTMHBY +++

There has to be a better way.  I will continue to look.
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 16, 2006, 11:37:19 AM
Something like this?
Code: [Select]
(while (< (strlen str) 16)
  (if (not (vl-catch-all-error-p
             (setq rtnval (vl-catch-all-apply 'getvar (list str)))
           )
      )
    (print (cons str rtnval) fn)
  )
  (setq str (upstringletters str (strlen str)))
)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 16, 2006, 11:41:35 AM
This is how I did it over the weekend since I thought I could get more system variables.
Code: [Select]
(while (< (strlen Str) 50)
 (if (getVar Str)
  (print (cons Str (getvar Str)) Opened)
 )
 (setq Str (UpStringLetters Str (strLen Str)))
)
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 16, 2006, 11:50:26 AM
That doesn't trap any errors that might occur & you are using getvar twice, not sure what the time penalty is for that.

What lisp statement generated the ERROR?
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 16, 2006, 11:53:12 AM
Question Tim -- <I'm trying to understand the cost / benefit ratio> What's the consequence if you have most, but not necessarily all of the system variables? Is it just a curiosity thing or is some absolute need fueling this?

For example, instead of the interrogation methods you've been employing you might use the information for the latest AutoCAD version from Autodesk (say Shaan Hurley's, or some para-site spin off) against any running version of AutoCAD (removing invalid members on the fly could be done relatively quickly). Might be shy the odd variable because of inadvertent (or deliberate) omission. What's the consequence?

Nosey me.
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 16, 2006, 12:09:29 PM
That doesn't trap any errors that might occur & you are using getvar twice, not sure what the time penalty is for that.

What lisp statement generated the ERROR?
There is no error when you use getvar with and invalid string, it just returns nil, so if it returns nil, skip it, and on to the next string.  The error was me this morning hitting escape, so that I can do my work.  :-)

Question Tim -- <I'm trying to understand the cost / benefit ratio> What's the consequence if you have most, but not necessarily all of the system variables? Is it just a curiosity thing or is some absolute need fueling this?
Just to know.  I like knowing what I'm using, and I know you can get list of system variables off the net, but I was wondering how one would get a full list.  I think I have been to the hyperpics site for a list.  Thought it would be a fun thing to try.   :wink:  Seems a little harder than I thought though, but still fun.
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 16, 2006, 12:12:37 PM
OH, OK.

Well your computer has nothing better to do while you're away. :-)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 16, 2006, 12:25:35 PM
Well your computer has nothing better to do while you're away. :-)
That is what I thought, but it didn't get as far as I hoped it would, so I think I need another approach.
Title: Re: Challenge: Get all system variables with values
Post by: CAB on October 16, 2006, 12:41:32 PM
So, why not start every evening where you left off.
Sooner or later the strings will be tested.
"ZZZZZZZZZZZZZZZZ" :)
Title: Re: Challenge: Get all system variables with values
Post by: MP on October 16, 2006, 12:49:43 PM
Just to know.  I like knowing what I'm using, and I know you can get list of system variables off the net, but I was wondering how one would get a full list.  I think I have been to the hyperpics site for a list.  Thought it would be a fun thing to try.   :wink:  Seems a little harder than I thought though, but still fun.

I can fully understand and appreciate that.

:)

Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 16, 2006, 12:54:52 PM
So, why not start every evening where you left off.
Sooner or later the strings will be tested.
"ZZZZZZZZZZZZZZZZ" :)
I was planning on that.  I change my code to ask where to start, and I planned on typing where it ended, but I still think this is the long road.  Maybe there isn't another road, but I still hope.  :ugly: :lol:
Title: Re: Challenge: Get all system variables with values
Post by: Guest on October 16, 2006, 01:55:00 PM
Quote
For example, instead of the interrogation methods you've been employing you might use the information for the latest AutoCAD version from Autodesk (say Shaan Hurley's, or some para-site spin off) against any running version of AutoCAD (removing invalid members on the fly could be done relatively quickly).

That doesn't cover any vertical variables though.  I'd be interested to see what's inside LDT, ADT & ABS (since I have all three installed on my machine).
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on October 16, 2006, 02:09:48 PM
I wonder if any other languages would know what ALL the system variables are.  Like if ObjectARX has a complete list somewhere.  Or if the other languages would be faster?  I will see what I can come up with.

/Thinking out loud.
Title: Re: Challenge: Get all system variables with values
Post by: rkmcswain on March 01, 2007, 09:05:50 AM
I wonder if any other languages would know what ALL the system variables are.  Like if ObjectARX has a complete list somewhere.  Or if the other languages would be faster?  I will see what I can come up with.

/Thinking out loud.

Any updated news on this topic?

Seems like there would be a way to hook the SETVAR command and extract the strings that it knows about (short of turning the logfileon and running [setvar;?;*]) I know that won't necessarily return the 'hidden' sysvars...

And I'm not even looking for the values - just the list of sysvar names. In such as way that you could run it on R14 or R2008 and it would return the sysvars...

The brute force method is not an option now with some 20 character sysvars in 2008....
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on March 01, 2007, 11:13:53 AM
I have not found any way yet.  In fact I haven't even thought about this since my last post.  It would be cool if anyone could find a way to do it.
Title: Re: Challenge: Get all system variables with values
Post by: rkmcswain on March 01, 2007, 02:34:58 PM
This is ugly, but it works.

Code: [Select]
  (setvar "logfilemode" 0) 
  (setvar "logfilepath" "c:\\temp\\")
  (setvar "qaflags" 3)
  (setvar "logfilemode" 1)
  (command "setvar" "?" "*")
  (graphscr)
  (setvar "logfilemode" 0)
  (setq fp (open (getvar "logfilename") "r") lst '())
  (while (setq a (read-line fp))
    (setq lst (cons a lst))
  )
  (close fp)
  (vl-file-delete (getvar "logfilename"))
  (setq lst (reverse lst))
  (setq i 1 newlst '())
  (foreach item lst   
    (setq pos (vl-string-position 32 item))   
    (setq sv (substr item 1 pos))
    (setq a (ascii (substr sv 1 1)) b (ascii (substr sv 2 1)))
    (if (and (> a 64)(< a 91)(> b 64)(< b 91))  
        (setq newlst (cons (substr item 1 pos) newlst))
    )
  )
  (reverse newlst)
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on March 01, 2007, 02:58:13 PM
Does it get them all? or just the one listed in the help files?  I would think just the ones list per
Seems like there would be a way to hook the SETVAR command and extract the strings that it knows about (short of turning the logfileon and running [setvar;?;*]) I know that won't necessarily return the 'hidden' sysvars...
Title: Re: Challenge: Get all system variables with values
Post by: rkmcswain on March 01, 2007, 03:02:53 PM
Does it get them all? or just the one listed in the help files?

Only what setvar;?;* reports. But if you are writing a routine that needs to know this list, it's slightly better than banking on a hardcoded list that will change between versions. Then again, maybe it isn't....???

You are right, if you are just trying to mine the sysvars for your own use and you want the "hidden" ones included, then that doesn't help much...
Title: Re: Challenge: Get all system variables with values
Post by: T.Willey on March 01, 2007, 03:19:36 PM
Does it get them all? or just the one listed in the help files?

Only what setvar;?;* reports. But if you are writing a routine that needs to know this list, it's slightly better than banking on a hardcoded list that will change between versions. Then again, maybe it isn't....???

You are right, if you are just trying to mine the sysvars for your own use and you want the "hidden" ones included, then that doesn't help much...
Thanks for the clarification.  I was trying something of the latter.