<?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: Lisp to run a command periodically in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5736399#M139847</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; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3171708"&gt;@tanvirme2k9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Sometimes it says unknown command "QSAVE". Is there a way to run reload only after a period of time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The lisp is not working correctlly. Having problem to save file.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It works for me. &amp;nbsp;I changed the value of TDUSRTIMER that it checks for to &lt;EM&gt;0.001&lt;/EM&gt; so it's triggered after only&amp;nbsp;&lt;EM&gt;1.44&lt;/EM&gt; minutes, for testing purposes. &amp;nbsp;It works whether I pick the save icon, or type in the Qsave command name, or presst Ctrl+S. &amp;nbsp;If I do so &lt;EM&gt;less than&lt;/EM&gt; 1.44 minutes after the last time, it just Qsaves without reloading Xrefs. &amp;nbsp;If I do it after more than 1.44 minutes has passed since the last time, it reloads all Xrefs and resets the timer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there others out there who can try it out to see whether it works correctly for them? &amp;nbsp;I'm on an older version where I am right now, so it's possible there's some version-dependent difference that may cause it to not work on newer versions.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Tested, &lt;SPAN class="hps"&gt;and it works&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;as expected.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;SPAN class="hps"&gt;'Sometimes it says unknown command "QSAVE". '&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;tanvirme2k9,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;are your 'alias' defined in 'acad.lsp' or 'acaddoc.lsp' files?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;If your 'qsave' alias, is defined in a function, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;i.e.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:q nil
(command "qsave")
(princ) 
)&lt;/PRE&gt;
&lt;P&gt;after loading the 'new' qsave function, if we enter 'q' to call the qsave command, &lt;SPAN class="hps alt-edited"&gt;we will get&lt;/SPAN&gt; a&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;SPAN class="hps"&gt;'Command: q&lt;BR /&gt;qsave Unknown command "QSAVE".&amp;nbsp; Press F1 for help.&lt;BR /&gt;Command:'&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2015 20:32:00 GMT</pubDate>
    <dc:creator>hmsilva</dc:creator>
    <dc:date>2015-07-22T20:32:00Z</dc:date>
    <item>
      <title>Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5726743#M139839</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a lisp which reloads all existing xrefs in the drawing. What I want is to run that command automatically after a period of time (like the auto save command) so that I need not to reload the xref manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;(defun c:XRE ()&lt;BR /&gt;(command "-Xref" "reload" "*")&lt;BR /&gt;)&lt;/LI-SPOILER&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 09:17:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5726743#M139839</guid>
      <dc:creator>tanvirme2k9</dc:creator>
      <dc:date>2015-07-20T09:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5726840#M139840</link>
      <description>&lt;P&gt;Start routine can be associated with something you do often manually. For example, saving or regen.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 10:57:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5726840#M139840</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-07-20T10:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5727102#M139841</link>
      <description>How to make my custom 'XRE' command to work like saving or regen? i.e it will reload all xref after 10 or 15 minutes periodically.</description>
      <pubDate>Mon, 20 Jul 2015 13:48:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5727102#M139841</guid>
      <dc:creator>tanvirme2k9</dc:creator>
      <dc:date>2015-07-20T13:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5727251#M139842</link>
      <description>&lt;P&gt;I think it's a good practise save your drawing each 10-15 min. (and not rely on autosave). This means you need to run this manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:XRE () ;Save and Xref reload
  (command "_.QSAVE")
  (command "_.-XREF" "_Reload" "*")
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jul 2015 14:30:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5727251#M139842</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-07-20T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5729166#M139843</link>
      <description>&lt;P&gt;Here's one way to tie it to the QSAVE command, so that every time you Qsave the drawing, whether with Ctrl+S or a menu icon or the command name or an alias, it will check whether enough time has elapsed since the last Xref-Reload for it to do that again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(command&lt;BR /&gt;&amp;nbsp; "_.time" "_on" "" ; just in case the user elapsed timer is off&lt;BR /&gt;&amp;nbsp; "_.undefine" "QSAVE"&lt;BR /&gt;); command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:QSAVE () ; new definition&lt;BR /&gt;&amp;nbsp; (command "_.qsave"); run native Qsave command&lt;BR /&gt;&amp;nbsp; (if (&amp;gt; (getvar 'tdusrtimer) 0.01); [0.01 of a day = 14.4 minutes elapsed yet?] -- EDIT 0.01 as desired&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (command&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "_.xref" "_reload" "*" ; reload all Xref's&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "_.time" "_reset" "" ; reset user timer to 0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ); command&lt;BR /&gt;&amp;nbsp; ); if&lt;BR /&gt;); defun&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It &lt;EM&gt;won't&lt;/EM&gt;, however, just reload them all at regular intervals, even (for example) when you're out to lunch. &amp;nbsp;It depends on being tied to the use of Qsave [it could be similarly tied to any other command you prefer, or even to more than one]. &amp;nbsp;But it has the advantage that you don't need to call for an Xref-Reloading command explicitly, so you don't need to have it in mind, and should be pretty reliable assuming you save regularly anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure that any macro or menu item you have that runs [or includes] Qsave uses the command name &lt;EM&gt;without&lt;/EM&gt; the decimal-point prefix, so that it will invoke the &lt;EM&gt;new&lt;/EM&gt; definition instead of the native definition.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 16:38:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5729166#M139843</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-07-20T16:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5730084#M139844</link>
      <description>Sometimes it says unknown command "QSAVE". Is there a way to run reload only after a period of time?</description>
      <pubDate>Tue, 21 Jul 2015 05:51:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5730084#M139844</guid>
      <dc:creator>tanvirme2k9</dc:creator>
      <dc:date>2015-07-21T05:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5733278#M139845</link>
      <description>&lt;P&gt;The lisp is not working correctlly. Having problem to save file.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 10:20:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5733278#M139845</guid>
      <dc:creator>tanvirme2k9</dc:creator>
      <dc:date>2015-07-22T10:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5733609#M139846</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3171708"&gt;@tanvirme2k9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Sometimes it says unknown command "QSAVE". Is there a way to run reload only after a period of time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The lisp is not working correctlly. Having problem to save file.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It works for me. &amp;nbsp;I changed the value of TDUSRTIMER that it checks for to &lt;EM&gt;0.001&lt;/EM&gt; so it's triggered after only&amp;nbsp;&lt;EM&gt;1.44&lt;/EM&gt; minutes, for testing purposes. &amp;nbsp;It works whether I pick the save icon, or type in the Qsave command name, or presst Ctrl+S. &amp;nbsp;If I do so &lt;EM&gt;less than&lt;/EM&gt; 1.44 minutes after the last time, it just Qsaves without reloading Xrefs. &amp;nbsp;If I do it after more than 1.44 minutes has passed since the last time, it reloads all Xrefs and resets the timer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there others out there who can try it out to see whether it works correctly for them? &amp;nbsp;I'm on an older version where I am right now, so it's possible there's some version-dependent difference that may cause it to not work on newer versions.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 14:15:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5733609#M139846</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-07-22T14:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5736399#M139847</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; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3171708"&gt;@tanvirme2k9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Sometimes it says unknown command "QSAVE". Is there a way to run reload only after a period of time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The lisp is not working correctlly. Having problem to save file.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It works for me. &amp;nbsp;I changed the value of TDUSRTIMER that it checks for to &lt;EM&gt;0.001&lt;/EM&gt; so it's triggered after only&amp;nbsp;&lt;EM&gt;1.44&lt;/EM&gt; minutes, for testing purposes. &amp;nbsp;It works whether I pick the save icon, or type in the Qsave command name, or presst Ctrl+S. &amp;nbsp;If I do so &lt;EM&gt;less than&lt;/EM&gt; 1.44 minutes after the last time, it just Qsaves without reloading Xrefs. &amp;nbsp;If I do it after more than 1.44 minutes has passed since the last time, it reloads all Xrefs and resets the timer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there others out there who can try it out to see whether it works correctly for them? &amp;nbsp;I'm on an older version where I am right now, so it's possible there's some version-dependent difference that may cause it to not work on newer versions.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Tested, &lt;SPAN class="hps"&gt;and it works&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;as expected.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;SPAN class="hps"&gt;'Sometimes it says unknown command "QSAVE". '&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;tanvirme2k9,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;are your 'alias' defined in 'acad.lsp' or 'acaddoc.lsp' files?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;If your 'qsave' alias, is defined in a function, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN&gt;i.e.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:q nil
(command "qsave")
(princ) 
)&lt;/PRE&gt;
&lt;P&gt;after loading the 'new' qsave function, if we enter 'q' to call the qsave command, &lt;SPAN class="hps alt-edited"&gt;we will get&lt;/SPAN&gt; a&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;SPAN class="hps"&gt;'Command: q&lt;BR /&gt;qsave Unknown command "QSAVE".&amp;nbsp; Press F1 for help.&lt;BR /&gt;Command:'&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 20:32:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5736399#M139847</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-07-22T20:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5736962#M139848</link>
      <description>Right it's showing like this. How to fix. I don't know where the alias is defined.</description>
      <pubDate>Thu, 23 Jul 2015 09:54:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5736962#M139848</guid>
      <dc:creator>tanvirme2k9</dc:creator>
      <dc:date>2015-07-23T09:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to run a command periodically</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5738384#M139849</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3171708"&gt;@tanvirme2k9&lt;/a&gt; wrote:&lt;BR /&gt;Right it's showing like this. How to fix. I don't know where the alias is defined.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Undefining a command, we can't call the undefined command via &lt;EM&gt;'command'&lt;/EM&gt; function, we have to call the original command...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i.e.&lt;/P&gt;
&lt;PRE&gt;(command "_.undefine" "QSAVE")&lt;/PRE&gt;
&lt;P&gt;to call the original &lt;EM&gt;'QSAVE'&lt;/EM&gt; command, we'll have to &lt;SPAN class="hps"&gt;precede thye command with a &lt;SPAN class="hps alt-edited"&gt;dot&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(command ".qsave")&lt;/PRE&gt;
&lt;P&gt;or to call Kent1Cooper's &lt;EM&gt;'C:QSAVE'&lt;/EM&gt; from another function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(C:QSAVE)&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3171708"&gt;@tanvirme2k9&lt;/a&gt; wrote:&lt;BR /&gt;...Is there a way to run reload only after a period of time?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, there is.&lt;/P&gt;
&lt;P&gt;Do you need the code to run in all dwg's?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2015 20:02:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-run-a-command-periodically/m-p/5738384#M139849</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-07-23T20:02:10Z</dc:date>
    </item>
  </channel>
</rss>

