<?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 Help with Global Variable from Edit_Box in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868539#M107086</link>
    <description>&lt;P&gt;Good morning,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point in my code, all I am trying to do is get user input in an edit_box in my dcl, and pass it to a global variable.&amp;nbsp; That's it.&amp;nbsp; Not trying to use that variable for anything yet... just capture it.&amp;nbsp; No matter what I try I get some sort of an error, mostly&amp;nbsp;; error: bad argument type: stringp nil, when trying to view Alert the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eventually I will be using this with a block attribute increment program.&amp;nbsp; I found that code in these forums and it works great.... but I need to be able to use these global variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My dcl and lsp are attached, would someone have time to take a peek?&amp;nbsp; TIA!!&lt;/P&gt;</description>
    <pubDate>Tue, 20 Mar 2018 14:42:54 GMT</pubDate>
    <dc:creator>cbenner</dc:creator>
    <dc:date>2018-03-20T14:42:54Z</dc:date>
    <item>
      <title>Help with Global Variable from Edit_Box</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868539#M107086</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point in my code, all I am trying to do is get user input in an edit_box in my dcl, and pass it to a global variable.&amp;nbsp; That's it.&amp;nbsp; Not trying to use that variable for anything yet... just capture it.&amp;nbsp; No matter what I try I get some sort of an error, mostly&amp;nbsp;; error: bad argument type: stringp nil, when trying to view Alert the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eventually I will be using this with a block attribute increment program.&amp;nbsp; I found that code in these forums and it works great.... but I need to be able to use these global variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My dcl and lsp are attached, would someone have time to take a peek?&amp;nbsp; TIA!!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:42:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868539#M107086</guid>
      <dc:creator>cbenner</dc:creator>
      <dc:date>2018-03-20T14:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Global Variable from Edit_Box</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868891#M107087</link>
      <description>&lt;P&gt;&lt;SPAN&gt;RE: pnum itinc etinc ltinc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To use these as global variables, don't localize them.&lt;/P&gt;&lt;P&gt;Change the first line of your code&lt;/P&gt;&lt;P&gt;from:&lt;/P&gt;&lt;P&gt;(defun C:setup ( pnum itinc etinc ltinc / )&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;(defun C:setup ( )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then load Dwg_Setup.lsp again&lt;/P&gt;&lt;P&gt;At the command prompt enter:&lt;/P&gt;&lt;P&gt;SETUP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the dialog should come up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Go ahead &amp;amp; make some changes to the entries and click OK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now to see if the variables get set, at the command prompt precede each variable with an ! exclamation mark:&lt;/P&gt;&lt;P&gt;!pnum&amp;nbsp;&lt;/P&gt;&lt;P&gt;!itinc&amp;nbsp;&lt;/P&gt;&lt;P&gt;!etinc&lt;/P&gt;&lt;P&gt;!ltinc&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: As a convention, I would match the new lisp command name to the same as the file name ie:&lt;/P&gt;&lt;P&gt;(defun C:Dwg_setup ( )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="MsoNormal"&gt;&lt;A href="http://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3aareaobjectlink_windows32and64%3aen" target="_blank"&gt;Area Object Link&lt;/A&gt; | &lt;A href="https://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3addattmod_windows32and64%3aen" target="_blank"&gt;Attribute Modifier&lt;/A&gt; | &lt;A href="http://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3addsetup_windows32and64%3aen" target="_blank"&gt;Dwg Setup&lt;/A&gt; | &lt;A href="https://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3addcalc_windows32and64%3aen" target="_blank"&gt;Feet-Inch Calculator &lt;/A&gt;&lt;SPAN style="font-family: Arial,sans-serif; text-shadow: auto;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;A href="https://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3alayerapps_windows32and64%3aen" target="_blank"&gt;Layer Apps&lt;/A&gt; | &lt;A href="https://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3addlist_windows32and64%3aen" target="_blank"&gt;List on Steroids&lt;/A&gt; | &lt;A href="https://apps.exchange.autodesk.com/ACD/en/Detail/Index?id=appstore.exchange.autodesk.com%3addzmscl_windows32and64%3aen" target="_blank"&gt;VP Zoom Scales&lt;/A&gt; | &lt;A href="https://apps.exchange.autodesk.com/ACD/en/Home/Index" target="_blank"&gt;Exchange App Store&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 16:06:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868891#M107087</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2018-03-20T16:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Global Variable from Edit_Box</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868909#M107088</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. In the DCL the kay values should have been strings&lt;/P&gt;
&lt;PRE&gt;DWG_Setup : dialog {				//dialog name
    label = "P&amp;amp;ID Drawing Setup" ;	        //give it a label

    : row {					//*define row

        : edit_box { label = "Process Number"; key = "prnum"; width = 7; value = "100"; }
	: edit_box { label = "Inst Tag Incr"; key = "ininc"; width = 7; value = "1"; }
	: edit_box { label = "Equip Tag Incr"; key = "eqinc"; width = 7; value = "5"; }
	: edit_box { label = "Line Tag Incr"; key = "liinc"; width = 7; value = "10"; }
    }
    ok_cancel ;				        //predifined OK/Cancel

}					        //end dialog&lt;/PRE&gt;
&lt;P&gt;2. You're talking about assigning global variable, but you're using the same symbols as the arguments of the function (that you never use in the code)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. You do not need the (set_tile ...) statements in the LISP if you used Value = ... in the DCL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. You should not have any expression after (done_dialog), use the value returned by start_dialog instead of userclick)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun C:setup (/ p i e l status)

  (setq dcl_id (load_dialog "DWG_setup.dcl"))
  (if (not (new_dialog "DWG_Setup" dcl_id))
    (exit)
  )

  (action_tile "prnum" "(setq p $value)")
  (action_tile "ininc" "(setq i $value)")
  (action_tile "eqinc" "(setq e $value)")
  (action_tile "liinc" "(setq l $value)")
  (action_tile "cancel" "(done_dialog 0)")
  (action_tile "accept" "(done_dialog 1)")

  (setq status (start_dialog))
  (unload_dialog dcl_id)

  ;; if the user clicked OK (done_dialog 1)
  ;; set the global variables
  (if (= status 1)
    (setq pnum p
          itinc i
          etinq e
          ltinc l
          userclick T
    )
    (setq userclick nil)
  )
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Mar 2018 16:12:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7868909#M107088</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-20T16:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Global Variable from Edit_Box</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7869005#M107089</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. In the DCL the kay values should have been strings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Thanks for that, I knew that and looked right at it, and didn't see it.&amp;nbsp; More coffee needed?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You're talking about assigning global variable, but you're using the same symbols as the arguments of the function (that you never use in the code)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;That's because I don't know what I'm doing.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. You do not need the (set_tile ...) statements in the LISP if you used Value = ... in the DCL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. You should not have any expression after (done_dialog), use the value returned by start_dialog instead of userclick)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;The code you modified works very nicely.&amp;nbsp; Thank you for the help.&amp;nbsp; I haven't done any kind of lisp in 25 years.&amp;nbsp; I like to try what I can first, and then ask for help when I get very lost.&amp;nbsp; I learn a lot from you guys who do this all the time.&amp;nbsp; SO, thank you!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 16:40:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-global-variable-from-edit-box/m-p/7869005#M107089</guid>
      <dc:creator>cbenner</dc:creator>
      <dc:date>2018-03-20T16:40:36Z</dc:date>
    </item>
  </channel>
</rss>

