<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>CAD Forum discussion (EN) : Retrieving last command</title>
  <link>https://www.cadforum.cz/forum_en/</link>
  <description><![CDATA[This is an XML content feed of; CAD Forum discussion (EN) : AutoCAD : Retrieving last command]]></description>
  <pubDate>Fri, 10 Jul 2026 03:16:24 +0000</pubDate>
  <lastBuildDate>Mon, 16 Feb 2015 15:38:05 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://www.cadforum.cz/forum_en/RSS_post_feed.asp?TID=10982</WebWizForums:feedURL>
  <image>
   <title><![CDATA[CAD Forum discussion (EN)]]></title>
   <url>https://www.cadforum.cz/forum_en/forum_images/web_wiz_forums.png</url>
   <link>https://www.cadforum.cz/forum_en/</link>
  </image>
  <item>
   <title><![CDATA[Retrieving last command :   ver101101 wrote: Doyou know...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=10982&amp;PID=29078&amp;title=retrieving-last-command#29078</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=353260">Kent Cooper</a><br /><strong>Subject:</strong> 10982<br /><strong>Posted:</strong> 16.Feb.2015 at 15:38<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by ver101101" alt="Originally posted by ver101101" style="vertical-align: text-bottom;" /> <strong>ver101101 wrote:</strong><br /><br /><P><FONT size=3>Do&nbsp;you know how to retrieve the last command entered at the command prompt via autolisp program. Accessing this is only available at the pop-up menu or by pressing enter.&nbsp; Is there a (getvar "lastcommand variable")? Thanks.</FONT></P></td></tr></table> <DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>Here's one way to force it, by temporarily recalling the last command and&nbsp;looking at what commands are then active:</DIV><DIV>&nbsp;</DIV><DIV>(progn (command "" (setq lastcommand (getvar 'cmdnames))))</DIV><DIV>&nbsp;</DIV><DIV>That will put the command name into the <EM>lastcommand</EM> variable, and leave you with an error message about invalid input -- follow it with another (command) function with no arguments to cancel the re-invoked command, however including that additional (command) <EM>within</EM> the (progn) function doesn't work.&nbsp; &#091;There may be a way to use (vl-catch-all-apply) to avoid delivery of that error message, but in some quick tries I didn't find the right format.&#093;</DIV><DIV>&nbsp;</DIV><DIV>EDIT:&nbsp; However, that will work only if the command requires input, and is therefore still running at the time it gets to the (setq) function.&nbsp; It won't work if the last command was something requiring no input, such as REDRAW, REGEN, LAYERP, etc. -- the lastcommand variable will then have "" in it.&nbsp; And if that's likely at times when you might use something like this, you might not want to -- you probably wouldn't want to&nbsp;run &#091;for instance&#093; LAYERP again just in order to find out that it was the last command.</DIV><span style="font-size:10px"><br /><br />Edited by Kent Cooper - 17.Feb.2015 at 15:08</span>]]>
   </description>
   <pubDate>Mon, 16 Feb 2015 15:38:05 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=10982&amp;PID=29078&amp;title=retrieving-last-command#29078</guid>
  </item> 
  <item>
   <title><![CDATA[Retrieving last command : Doyou know how to retrieve the...]]></title>
   <link>https://www.cadforum.cz/forum_en/forum_posts.asp?TID=10982&amp;PID=29063&amp;title=retrieving-last-command#29063</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="https://www.cadforum.cz/forum_en/member_profile.asp?PF=536501">ver101101</a><br /><strong>Subject:</strong> 10982<br /><strong>Posted:</strong> 13.Feb.2015 at 19:14<br /><br /><p><font size="3">Do&nbsp;you know how to retrieve the last command entered at the command prompt via autolisp program. Accessing this is only available at the pop-up menu or by pressing enter.&nbsp; Is there a (getvar "lastcommand variable")? Thanks.</font></p>]]>
   </description>
   <pubDate>Fri, 13 Feb 2015 19:14:23 +0000</pubDate>
   <guid isPermaLink="true">https://www.cadforum.cz/forum_en/forum_posts.asp?TID=10982&amp;PID=29063&amp;title=retrieving-last-command#29063</guid>
  </item> 
 </channel>
</rss>