<?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 CMDACTIVE and using MTEXT in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12169961#M25688</link>
    <description>&lt;P&gt;No more response from Autocad when using this little piece of code.&lt;BR /&gt;For my part, I think that the MTEXT editor is not managed by the CDMACTIVE variable.&lt;BR /&gt;How to circumvent this problem while preserving the principle?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be careful before using this piece of code, you will have to kill the task.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;((lambda ( / )
  (command "_.mtext")
  (while (not (zerop (getvar "CMDACTIVE")))
    (command pause)
  )
))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2023 15:33:56 GMT</pubDate>
    <dc:creator>CADaSchtroumpf</dc:creator>
    <dc:date>2023-08-14T15:33:56Z</dc:date>
    <item>
      <title>CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12169961#M25688</link>
      <description>&lt;P&gt;No more response from Autocad when using this little piece of code.&lt;BR /&gt;For my part, I think that the MTEXT editor is not managed by the CDMACTIVE variable.&lt;BR /&gt;How to circumvent this problem while preserving the principle?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be careful before using this piece of code, you will have to kill the task.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;((lambda ( / )
  (command "_.mtext")
  (while (not (zerop (getvar "CMDACTIVE")))
    (command pause)
  )
))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 15:33:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12169961#M25688</guid>
      <dc:creator>CADaSchtroumpf</dc:creator>
      <dc:date>2023-08-14T15:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170011#M25689</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/524107"&gt;@CADaSchtroumpf&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... I think that the MTEXT editor is not managed by the CDMACTIVE variable...&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you want it to be?&amp;nbsp; If I set CMDACTIVE to 0, and do&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (command "_.mtext")&lt;/FONT&gt;&lt;/STRONG&gt;, it asks for a box, but then takes content input only at the Command line, not as editing box on-screen, so the CMDACTIVE setting does make a difference.&amp;nbsp; If I establish points for the box ahead of time in variables, I can feed those into the command so I don't have to specify the box on-screen within it, and it goes right into taking content at the Command line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you wanting it to work &lt;EM&gt;with the editing box on-screen&lt;/EM&gt; even when CMDACTIVE is 0?&amp;nbsp; If so, preceding it with&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (initdia) &lt;/FONT&gt;&lt;/STRONG&gt;works for me.&amp;nbsp; If not, what are you looking for, operationally?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Why&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (lambda)&lt;/FONT&gt;&lt;/STRONG&gt;?]&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 15:49:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170011#M25689</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-08-14T15:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170102#M25690</link>
      <description>&lt;P&gt;I have this approach marked "Mtext - best dynamic solution for 2015+" in my archive... so&amp;nbsp;hopefully it will suit you...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:MtextLisp nil
  (command "_.MTEXT" pause pause "Text" "")
  (setpropertyvalue (entlast) "Contents" "")
  (command "_.mtedit" "_last")
  (command "line" pause pause "") ;; test line
  (princ)
)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 16:36:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170102#M25690</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-08-14T16:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170268#M25691</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank Kent,&lt;/P&gt;&lt;P&gt;Indeed (initdia) solved my problem.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/524107"&gt;@CADaSchtroumpf&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;what are you looking for, operationally?&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is for this, see the tempolary lisp code.&lt;/P&gt;&lt;P&gt;But now I also have a problem with the TEXT command which registers the pause symbol for me as a text value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 17:57:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170268#M25691</guid>
      <dc:creator>CADaSchtroumpf</dc:creator>
      <dc:date>2023-08-14T17:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170274#M25692</link>
      <description>&lt;P&gt;Thanks BeekeeCZ, but my need is to use CMDACTIVE&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 18:00:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170274#M25692</guid>
      <dc:creator>CADaSchtroumpf</dc:creator>
      <dc:date>2023-08-14T18:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170309#M25693</link>
      <description>&lt;P&gt;Instead of starting the command and then using the (while) function checking whether the command is still active, try this method of having it continue to wait for User input until the command is completed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(initdia)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;(command-s "_.mtext")&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 18:24:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170309#M25693</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-08-14T18:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170490#M25694</link>
      <description>&lt;P&gt;I use CAB's verion as a template in my shorty/helper thing that does text stuff. &lt;A href="https://www.theswamp.org/index.php?topic=47305.msg523441#msg523441" target="_blank"&gt;https://www.theswamp.org/index.php?topic=47305.msg523441#msg523441&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kent1Cooper,&lt;BR /&gt;The "((lambda ( / ) ... " Is a way/method to post an auto-running-example -i.e. "here is some code you can copy-paste to run a simple example". At least, that is how I do it so new users don't have to type anything to run a quick example I post.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 19:54:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170490#M25694</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-08-14T19:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170553#M25695</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12045724"&gt;@john.kaulB9QW2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... The "((lambda ( / ) ... " Is a way/method to post an auto-running-example ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It works just the same without the ((lambda)) wrapper, for me [including, in this case, locking up AutoCAD].&amp;nbsp; Try it, with [for example] "_.line" instead of "_.mtext".&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 20:20:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170553#M25695</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-08-14T20:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170596#M25696</link>
      <description>&lt;P&gt;What I tried to say is this "can be simpler"&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;((lambda ( / )
  (command "_.line")
  ...))&lt;/LI-CODE&gt;&lt;P&gt;than either of these two&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun foo ( / )
  (command "_.line")
  ...)

(defun c:bar ( / )
  (comand "_.line")
  ...)&lt;/LI-CODE&gt;&lt;P&gt;because all WE would have to do is copy and paste the first into the command line and it would run. The latter two require US to type either (FOO) or BAR in the command line to run. -i.e. the OP was being kind (polite) by offering a way for us to quickly(er) test their concept.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(
 (lambda (x y z) (+ x y z))
 1 2 3)&lt;/LI-CODE&gt;&lt;P&gt;is called the LET CONSTRUCT. -i.e. in this form of LAMBDA, the 1 2 3 values are "assigned" to the X Y Z variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, after I took the SICP course using SCHEME, I developed a habit of typing my functions like this:&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun baz ()
 ((lambda ()
   (command "_.line")
   ...)))&lt;/LI-CODE&gt;&lt;P&gt;but that was just a quirk and only lasted a little bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...That concludes our discussion into lambda.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 20:36:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12170596#M25696</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-08-14T20:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171245#M25697</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;Many thanks John&lt;BR /&gt;CAB's solution for text is superb, I didn't know about this option:&lt;BR /&gt;(while (= (logand (getvar "cmdactive") 1) 1)&lt;BR /&gt;(command "\\acedpause")&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 05:13:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171245#M25697</guid>
      <dc:creator>CADaSchtroumpf</dc:creator>
      <dc:date>2023-08-15T05:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171248#M25698</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;[Why&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (lambda)&lt;/FONT&gt;&lt;/STRONG&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/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For (lambda) I used it for; as John said, that copy-paste in command line works correctly.&lt;BR /&gt;If you copy-paste only:&lt;BR /&gt;(command "_.mtext")&lt;BR /&gt;(while (not (zerop (getvar "CMDACTIVE")))&lt;BR /&gt;(command pause)&lt;BR /&gt;)&lt;BR /&gt;It does not work!&lt;BR /&gt;But actually I could have used for example a progn for the sequence to be done.&lt;BR /&gt;I use ((lambda...)) a lot when I know that the code in it will only be used once in the drawing or it is executed on the fly&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 05:17:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171248#M25698</guid>
      <dc:creator>CADaSchtroumpf</dc:creator>
      <dc:date>2023-08-15T05:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171896#M25699</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/524107"&gt;@CADaSchtroumpf&lt;/a&gt;&amp;nbsp;wrote:
&lt;P class="1692101822148"&gt;..&lt;SPAN&gt;..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If you copy-paste only:&lt;BR /&gt;(command "_.mtext")&lt;BR /&gt;(while (not (zerop (getvar "CMDACTIVE")))&lt;BR /&gt;(command pause)&lt;BR /&gt;)&lt;BR /&gt;It does not work!&lt;BR /&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It does not work with the ((lambda) wrapper around it, either [that's the whole reason for this topic], so what's the benefit?&amp;nbsp; In either case, I get to define the Mtext box, and then it locks up.&amp;nbsp; That's an "_.mtext"-specific issue, because of the pause being taken as if it were text input, instead of waiting for User input.&amp;nbsp; Try it with "_line" instead -- it works &lt;EM&gt;with or without&lt;/EM&gt; the wrapper.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:23:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171896#M25699</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-08-15T12:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: CMDACTIVE and using MTEXT</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171984#M25700</link>
      <description>Kent1Cooper,&lt;BR /&gt;I have no idea why you are focusing so hard on the lambda-wrapper but you are missing the point behind its use in this context. You also edited the quote (and removed the most important words in the post -i.e. you simplified the quote removing important words).&lt;BR /&gt;&lt;BR /&gt;CADaSchtroumpf,&lt;BR /&gt;I think the lambda-wrapper--in this context--is also a very good visual. Yes, a progn would work as well--for the general task of grouping a series of statements--but a lambda-wrapper is nice because you can generally localize variables in examples). Same rule (localize variables) goes for when executing single-use-code in a "startup-lisp thing".&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:58:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/cmdactive-and-using-mtext/m-p/12171984#M25700</guid>
      <dc:creator>john.kaulB9QW2</dc:creator>
      <dc:date>2023-08-15T12:58:02Z</dc:date>
    </item>
  </channel>
</rss>

