<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Global Variable List in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965620#M29951</link>
    <description>&lt;P&gt;I am building a dialog box for creating a piece drawing label which lists part name, number, quantity, material, drawing scale and optional additional information. Most of the information is going to be unique to the drawing session but some parts will share some information, ie... the material will usually not change but the quantities will.&lt;/P&gt;&lt;P&gt;So I am not seeing a need to save this information for more than the session.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Answering these questions&amp;nbsp;has been very helpful in thinking about other ways I may want the data to be available to the user, like possible adding a reset button to the dialog box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will certainly look into&amp;nbsp;&lt;SPAN&gt;(setcfg) and (getcfg)&amp;nbsp;for possible use in the future. Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 May 2023 20:33:01 GMT</pubDate>
    <dc:creator>jcpLPAKD</dc:creator>
    <dc:date>2023-05-15T20:33:01Z</dc:date>
    <item>
      <title>Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964803#M29938</link>
      <description>&lt;P&gt;I am writing a dialog box that is going to have 15 to variables that will need to be recalled when the dialog box is opened again.&amp;nbsp; I would like to save all the variables to a single list and recall them later rather than having 15 global variables.&amp;nbsp; I stumbled on how to do this the other day and now I can't find the post again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 14:44:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964803#M29938</guid>
      <dc:creator>jcpLPAKD</dc:creator>
      <dc:date>2023-05-15T14:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964936#M29939</link>
      <description>Which 15 variables are you wishing to track exactly?</description>
      <pubDate>Mon, 15 May 2023 15:49:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964936#M29939</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2023-05-15T15:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964944#M29940</link>
      <description>&lt;P&gt;That's a very vague description/request. Are you talking about an association list or just a list? In the most general terms you'll need a basic list "push" and "pop" function(s) to add/remove items to this list. Please be more specific in your description/needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun list-push (sym lst) 
  ;; list-push
  ;; put an item first into existing list.
  ;; 
  ;; Example: 
  ;;    (list-push 'one 'masterlist)
  ;;    &amp;gt; (ONE)
  ;;    &amp;gt; !masterlist
  ;;    &amp;gt; (ONE)
  ;; OR
  ;;    (setq mylist '(2 3 4))
  ;;    (list-push 1 'mylist)
  ;;    &amp;gt; (1 2 3 4)
  ;;    &amp;gt; !mylist
  ;;    &amp;gt; (1 2 3 4)
  ;;
  ;; By: John K
  ;;    (inspired by Vladimir Nesterovsky)
  ;; 10.24.05
  (set lst (cons sym (eval lst))) )

(defun list-pop (lst / ~tval )
  ;; list-pop
  ;;
  ;; remove the first item from a list and redefne 
  ;; the var containing that list. 
  ;; 
  ;; Example:
  ;; Given a list called "masterlist" with the 
  ;; value of: (TWO ONE)
  ;;
  ;; !masterlist
  ;; (TWO ONE)
  ;;
  ;; (list-pop 'masterlist)
  ;; TWO
  ;;
  ;; (list-pop 'masterlist)
  ;; ONE
  ;;
  ;; !masterlist
  ;; nil
  ;;
  ;; By: John K
  ;;    (inspired by Vladimir Nesterovsky)
  ;;
  ;; 10.24.05
  (setq ~tval (eval lst))
  (set lst (cdr ~tval))
  (car ~tval) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 15:51:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964944#M29940</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-05-15T15:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964973#M29941</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5286825"&gt;@jcpLPAKD&lt;/a&gt;&amp;nbsp;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LISP is exactly the right language to hold a list of values and have wonderful functions to retrieve. cause you did not post your variables here is a general example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(setq iA 5 iB 9 iC -3) ; intergers&lt;/P&gt;&lt;P&gt;(setq rA 2.50 rB 8.38 rC -7.98) ; reals&lt;/P&gt;&lt;P&gt;you can do the same with strings, lists, points&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now lets wrap them in list:&lt;/P&gt;&lt;P&gt;(setq lst '()) ; reset lst&lt;/P&gt;&lt;P&gt;(foreach var (list iA iB iC rA rB rC)&lt;/P&gt;&lt;P&gt;&amp;nbsp;(setq lst (cons var lst))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(princ (reverse lst))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The (cons) function construct the list. As opposed to (append) function, it construct the list in reverse (each item is appended in list head, that's why at the end of the construction we use (reverse) function. the question is why we do not use (append) instead? because (cons) is very fast and in construction of big lists it's the &lt;SPAN&gt;preferable&lt;/SPAN&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(car lst) ; return 5&lt;/P&gt;&lt;P&gt;(cadr lst) ; return 9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also (nth) function can retrieve values:&lt;/P&gt;&lt;P&gt;(nth 0 lst ; return 5&lt;/P&gt;&lt;P&gt;(nth 1 lst) ; return 9&lt;/P&gt;&lt;P&gt;(nth 2 lst) ; return -3&lt;/P&gt;&lt;P&gt;(nth 3 lst) ; return 2.50&lt;/P&gt;&lt;P&gt;(nth 4 lst) ; return 8.38&lt;/P&gt;&lt;P&gt;(nth 5 lst) ; return -7.98&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as you can see the first item in lst is index 0, second is 1, third 2 and so on...&lt;/P&gt;&lt;P&gt;if you want to know the type of a value, use (type) function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(type (nth 2 lst)) ; returns 'INT&lt;/P&gt;&lt;P&gt;(type (nth 5 lst)) ; return 'REAL&lt;/P&gt;&lt;P&gt;and if it is a string, it will return 'STR&lt;/P&gt;&lt;P&gt;if it's a list, it will return 'LIST&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:18:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11964973#M29941</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-05-15T16:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965014#M29942</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5286825"&gt;@jcpLPAKD&lt;/a&gt;&amp;nbsp;hi,&lt;/P&gt;&lt;P&gt;&amp;lt;SNIP&amp;gt;&lt;/P&gt;&lt;P&gt;(setq iA 5 iB 9 iC -3) ; intergers&lt;/P&gt;&lt;P&gt;(setq rA 2.50 rB 8.38 rC -7.98) ; reals&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now lets put them in list:&lt;/P&gt;&lt;P&gt;(foreach var (list iA iB iC rA rB rC)&lt;/P&gt;&lt;P&gt;&amp;nbsp;(setq lst (cons var lst))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(princ (reverse lst))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The (cons) function construct the list. As opposed to (append) function, it construct the list in reverse (each item is appended in list head, that's why at the end of the construction we use (reverse) function. the question is why we do not use (append) instead? because (cons) is very fast and in construction of big lists it's the &lt;SPAN&gt;preferable&lt;/SPAN&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;SNIP&amp;gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: why don't you just use `mapcar` instead of going through all that trouble of using a loop-construct and `cons`?&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; lst (&lt;/SPAN&gt;&lt;SPAN&gt;mapcar&lt;/SPAN&gt;&lt;SPAN&gt; 'eval '(iA iB iC rA rB rC)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT (John):&lt;/P&gt;&lt;P&gt;1. Before I get flack; I know `mapcar` is a looping-construct.&lt;/P&gt;&lt;P&gt;2. I just checked and the `mapcar` method I just posted is two times faster that the `foreach`/`cons` method.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:30:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965014#M29942</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-05-15T16:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965069#M29943</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12045724"&gt;@john.kaulB9QW2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: why don't you just use `mapcar` instead of going through all that trouble of using a loop-construct and `cons`?&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; lst (&lt;/SPAN&gt;&lt;SPAN&gt;mapcar&lt;/SPAN&gt;&lt;SPAN&gt; 'eval '(iA iB iC rA rB rC)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;because i think&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5286825"&gt;@jcpLPAKD&lt;/a&gt;&amp;nbsp;is in a beginner and (&lt;SPAN&gt;forgive&lt;/SPAN&gt; me if i'm wrong) using (cons) or (append) is much simple to understand comparing to (mapcar)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 16:45:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965069#M29943</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-05-15T16:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965149#M29944</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747"&gt;@Moshe-A&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;because i think&amp;nbsp;&lt;/SPAN&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5286825"&gt;@jcpLPAKD&lt;/a&gt;&lt;SPAN&gt;&amp;nbsp;is in a beginner and (&lt;/SPAN&gt;&lt;SPAN&gt;forgive&lt;/SPAN&gt;&lt;SPAN&gt; me if i'm wrong) using (cons) or (append) is much simple to understand comparing to (mapcar)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;*blink-blink* say what?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;`cons` means: "construct list of two EXPRESSIONS"&lt;BR /&gt;`mapcar` means: "map function to successive CAR's in a list"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;`cons` is a lot more complicated than I think you give it credit for; it will make two different types of lists -i.e regular and dotted depending on the arguments you give.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;`mapcar` is the basic form of doing something to each element in a list and it cannot get more basic than that.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Let's try to write out in words what each code block does:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Foreach variable in a list assign the item a temporary name of `VAR`. Then create/update a list with the value of the variable; because cons will evaluate each value of its arguments, the temporary name of `VAR` will point to the list variable which points to a value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(foreach var (list iA iB iC rA rB rC)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(setq lst (cons var lst))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Evaluate each variable in a list and return a list (of their values).&lt;/P&gt;&lt;P&gt;(setq lst (mapcar 'eval '(iA iB iC rA rB rC)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which is more complicated?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, we are way off track here; the OP needs to explain what (s)he wants to do with variables/a var (or value) list/dialog.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 17:18:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965149#M29944</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-05-15T17:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965215#M29945</link>
      <description>&lt;P&gt;Sorry I wasn't clearer on what I am trying to do.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently when closing the dialog box I am using get_tile to save the edit box and toggle values and individual to global variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;action_tile&lt;/SPAN&gt; &lt;SPAN&gt;"accept"&lt;/SPAN&gt; &lt;SPAN&gt;"(opt_o)(done_dialog 1)"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;defun&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;OPT_O ( )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; DT_VAL1 (&lt;/SPAN&gt;&lt;SPAN&gt;get_tile&lt;/SPAN&gt; &lt;SPAN&gt;"eb1"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; DT_VAL1a (&lt;/SPAN&gt;&lt;SPAN&gt;get_tile&lt;/SPAN&gt; &lt;SPAN&gt;"eb1a"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; DT_VAL1b (&lt;/SPAN&gt;&lt;SPAN&gt;get_tile&lt;/SPAN&gt; &lt;SPAN&gt;"eb1b"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; DT_VAL1c (&lt;/SPAN&gt;&lt;SPAN&gt;get_tile&lt;/SPAN&gt; &lt;SPAN&gt;"eb1c"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; DT_CK1 (&lt;/SPAN&gt;&lt;SPAN&gt;get_tile&lt;/SPAN&gt; &lt;SPAN&gt;"tg1"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN&gt;setq&lt;/SPAN&gt;&lt;SPAN&gt; DT_CK1a (&lt;/SPAN&gt;&lt;SPAN&gt;get_tile&lt;/SPAN&gt; &lt;SPAN&gt;"tg1a"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;;;;additonal variables to be determined&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;; end of OPT_O defun&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;It makes more sense to save these as local variables, add them to a list and save the list to a single global variable.&amp;nbsp; This is the first time I have had to deal with more than a couple of global variables in a routine and it makes sense to finally take the plunge into creating and breaking apart lists.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 17:49:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965215#M29945</guid>
      <dc:creator>jcpLPAKD</dc:creator>
      <dc:date>2023-05-15T17:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965313#M29946</link>
      <description>&lt;P&gt;I would do something like this:&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun *save-vars* ( lst / push-&amp;gt;lst)
 ;; This procedure will generate a list of
 ;; variables and their value.
 ;;
 ;; By: John Kaul
 ;;
 ;; Ex: (*save-vars*
 ;;        '(("eb1" 0) ("eb2" 1)
 ;;          ("eb1a" 3) ("eb1b" 4)))
 ;;
 ;; The syntax of the list members is as follows:
 ;;  (&amp;lt;Variable name&amp;gt; &amp;lt;value&amp;gt;)
   (defun push-&amp;gt;lst (sym lst)
     (set lst (cons sym (eval lst))) )
 (mapcar
  '(lambda (x)
       (push-&amp;gt;lst (list 'setq (read (car x)) (cadr x)) '#Dialog-Var_Lst#)
     )
    lst
   )
 )

(defun *restore-vars* () 
  ;; This procedure will restore a list of variables
  ;;
  ;; By: John Kaul
  ;;
  ;; EX: (*restore-vars*)
  (mapcar 'eval #Dialog-Var_Lst#) 
  (setq #Dialog-Var_Lst# nil) 
 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will create a variable called "#Dialog-Var_Lst#" with the variable names and values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not entirely sure what it is you mean by 'taking the plunge into creating and breaking apart lists' though.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 18:33:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965313#M29946</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-05-15T18:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965351#M29947</link>
      <description>I've avoided learning how to really understand working with lists. Most of the code I write rarely needs to access list information.</description>
      <pubDate>Mon, 15 May 2023 18:51:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965351#M29947</guid>
      <dc:creator>jcpLPAKD</dc:creator>
      <dc:date>2023-05-15T18:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965369#M29948</link>
      <description>&lt;P&gt;Are you talking about global variables only &lt;EM&gt;within the same editing session of the same drawing?&lt;/EM&gt;&amp;nbsp; That seems to be what the suggestions so far are about.&amp;nbsp; Do you want to be able to draw on those same variables in a later session, and/or in another drawing?&amp;nbsp; I'm wondering whether to pursue the idea of Environment Variables, or maybe (vl-propagate) to make them available in other drawings even if not in later editing sessions.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 18:59:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965369#M29948</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-05-15T18:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965382#M29949</link>
      <description>&lt;P&gt;Yes, they only need to be available in the current drawing session.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 19:05:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965382#M29949</guid>
      <dc:creator>jcpLPAKD</dc:creator>
      <dc:date>2023-05-15T19:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965483#M29950</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5286825"&gt;@jcpLPAKD&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You think you need these values only in the current session?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when you start your program (command) these variables are getting default value - right?!&lt;/P&gt;&lt;P&gt;during the dialog session, user can change these values - right?&lt;/P&gt;&lt;P&gt;at dialog close you are saving these values or maybe not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i assume you are familiar how some standard AutoCAD command dialog works? lets take OPTIONS or UNITS&amp;nbsp; commands,&amp;nbsp;as you make change to controls (tiles in dcl) they are saved for the next session - agree?&lt;/P&gt;&lt;P&gt;how this done? it's more simple than you think. they are save to registry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;before AutoLISP/VisulaLISP gave use functions to read\write to registry we had 2 nice functions to do a similar work&lt;/P&gt;&lt;P&gt;(setcfg) and (getcfg) i suggest you explore these functions and use them for your first dcl program (after you understand their magic you move to vl-read-registry, vl-write-registry)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so what you have to do is simple. at dialog close (setcfg) each global variable.&amp;nbsp;at dialog open (getcfg) each value back to set your edit_box&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you understand this concept, will will continue&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 20:03:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965483#M29950</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-05-15T20:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965620#M29951</link>
      <description>&lt;P&gt;I am building a dialog box for creating a piece drawing label which lists part name, number, quantity, material, drawing scale and optional additional information. Most of the information is going to be unique to the drawing session but some parts will share some information, ie... the material will usually not change but the quantities will.&lt;/P&gt;&lt;P&gt;So I am not seeing a need to save this information for more than the session.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Answering these questions&amp;nbsp;has been very helpful in thinking about other ways I may want the data to be available to the user, like possible adding a reset button to the dialog box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will certainly look into&amp;nbsp;&lt;SPAN&gt;(setcfg) and (getcfg)&amp;nbsp;for possible use in the future. Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 20:33:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965620#M29951</guid>
      <dc:creator>jcpLPAKD</dc:creator>
      <dc:date>2023-05-15T20:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable List</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965747#M29952</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5286825"&gt;@jcpLPAKD&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok i understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, in case you change your mind (or for a future project) here a nice sample how this is done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that all functions is declared as local plus local variables. with this structure you protect your program from been interfere by other program\functions using the same names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enjoy&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;// test.dcl
test_dialog : dialog {
  label = "Test Dialog";
 
  : column {
   : edit_box {
     label = "Text &amp;amp;Value";
     key = "text_value";
     edit_width = 10;
   }
  : edit_box {
    label = "&amp;amp;Increment";
    key = "increment";
    edit_width = 10;
  }
  : edit_box {
    label = "Text &amp;amp;Height";
    key = "text_height";
    edit_width = 10;
  }
 
 }// column

 spacer_1;

 ok_cancel;
}// dialog&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:test (/ restore_acadcfg_string save_acadcfg_string read_acadcfg ctrl_accept set_tiles ; local functions
	         APPDATAKEY dcl_id what_next txtval inc txthgt)

 (defun restore_acadcfg_string (KEY def / value)
  (setq value (getcfg (strcat APPDATAKEY KEY)))

  (if (or (not value) (eq value ""))
   (setcfg (strcat APPDATAKEY KEY) def)
   value
  )
 ); restore_acadcfg_string

  
 (defun save_acadcfg_string (KEY value)
  (setcfg (strcat APPDATAKEY KEY) value)
 ); save_acadcfg_string

  
 ; read from acadcfg file
 (defun read_acadcfg ()
  (setq txtval (restore_acadcfg_string "text_value"  "abc"))
  (setq inc    (restore_acadcfg_string "increment"  "1"))
  (setq txthgt (restore_acadcfg_string "text_height" "12"))
 );  read_acadcfg

  
 ; callback - ok button
 (defun ctrl_accept ()
  (foreach key '("text_value" "increment" "text_height")
   (if (/= (setq val (get_tile key)) "")
    (save_acadcfg_string key val)
   )
  ); foreach  
   
  (done_dialog 1)  ; close dialog  
 ); ctrl_accept

  
 ; set dialog tiles value
 (defun set_tiles ()
  (vl-every
   '(lambda (key val)
     (set_tile key val)
    )
   '("text_value" "increment" "text_height") (list txtval inc txthgt) 
  ); vl-evrey
 ); set_tiles
  
 
 ; here start c:test command
 (setq APPDATAKEY "AppData/John Palmer/") ; const

 (if (setq dcl_id (load_dialog "test"))
  (progn
   (read_acadcfg)
   (setq what_next 2)
   
   (while (&amp;gt; what_next 1)
    (if (not (new_dialog "test_dialog" dcl_id "" '(-1 -1))); open dialog at center
     (exit)
    )

    (set_tiles) ; set tiles value
     
    (action_tile "accept" "(ctrl_accept)") ; install callback
    
    (setq what_next (start_dialog)) ; here start events

    (cond
     ((= what_next 0) ; user pick cancel button
      ; do clean up
      ; no tiles values to save
      ; ...
      ; ...
     ); case
     ((= what_next 1) ; user pick OK
      ; do clean up
      ; tiles values already saved
      ; ...
      ; ...
     ); case
    ); cond
   ); while

   (unload_dialog dcl_id) ; unload test.dcl
  ); progn
 ); if
 
 (princ)
); c:test
  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 21:19:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/global-variable-list/m-p/11965747#M29952</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2023-05-15T21:19:52Z</dc:date>
    </item>
  </channel>
</rss>

