<?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: Batch file for script problem in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451043#M130381</link>
    <description>&lt;P&gt;My guess is it is in your batch code that is closing CAD each time. I forget what all the switches stand for off hand, but this code seems to work for me, and it does not close CAD after each file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FOR %%F IN ("C:\MY\FILE\PATH\*.DWG") DO "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /I "%%F" /S "&lt;SPAN&gt;C:\&lt;/SPAN&gt;&lt;SPAN&gt;MY&lt;/SPAN&gt;&lt;SPAN&gt;\&lt;/SPAN&gt;&lt;SPAN&gt;FILE&lt;/SPAN&gt;&lt;SPAN&gt;\&lt;/SPAN&gt;&lt;SPAN&gt;PATH&lt;/SPAN&gt;\MyScript.scr" /L en-US&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2016 21:00:47 GMT</pubDate>
    <dc:creator>redtransitconsultants</dc:creator>
    <dc:date>2016-07-20T21:00:47Z</dc:date>
    <item>
      <title>Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6448375#M130380</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have trialled writing a script and a batch file to carry out a series of tasks to a set of drawings in AutoCAD 2016.&lt;/P&gt;&lt;P&gt;The aim is to open the vendor supplied drawings, add a layer name, switch to a layout, insert a sheet border + attribute sheet, make defpoints the current layer and insert a single viewport, save &amp;amp; close.&lt;/P&gt;&lt;P&gt;Well the script works fine in a single drawing. However when I try to run the batch file, AutoCAD will open the file&amp;nbsp;invoke the script and run as expected, then quit out of AutoCAD, then repeat for the next file, etc, etc.&lt;/P&gt;&lt;P&gt;Is there a way I can speed this up by not shutting down AutoCAD each time. My script trials using 'close' instead of 'quit' do not work, just stops after the first file has been converted.&lt;/P&gt;&lt;P&gt;My Script file (xxxlayer.scr) is as follows;&lt;/P&gt;&lt;P&gt;-Layer&lt;BR /&gt;_new&lt;BR /&gt;xxx&lt;BR /&gt;_m&lt;BR /&gt;xxx&lt;/P&gt;&lt;P&gt;-layout&lt;BR /&gt;_set&lt;/P&gt;&lt;P&gt;_zoom&lt;BR /&gt;_extents&lt;BR /&gt;-insert&lt;BR /&gt;KCA5-A3E-PCMC.dwg&lt;BR /&gt;0,0&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;0&lt;BR /&gt;_zoom&lt;BR /&gt;Extents&lt;BR /&gt;-insert&lt;BR /&gt;KCA5-A3EA-PCMC.dwg&lt;BR /&gt;0,0&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-layer&lt;BR /&gt;_m&lt;BR /&gt;defpoints&lt;/P&gt;&lt;P&gt;_zoom&lt;BR /&gt;extents&lt;BR /&gt;-vports&lt;BR /&gt;20,43&lt;BR /&gt;410,287&lt;BR /&gt;qsave&lt;BR /&gt;quit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Batch File is as follows;&lt;/P&gt;&lt;P&gt;FOR %%f in (C:\temp\*.dwg) do start /wait C:\"Program Files"\"Autodesk\AutoCAD 2016"\acad.exe "%%f" /b "C:\temp\xxxlayer.scr"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is something new for me and am relatively pleased with how far I have progressed using information from this forum so far.&lt;/P&gt;&lt;P&gt;Looking forward to continuing to learn&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 01:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6448375#M130380</guid>
      <dc:creator>TDD</dc:creator>
      <dc:date>2016-07-20T01:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451043#M130381</link>
      <description>&lt;P&gt;My guess is it is in your batch code that is closing CAD each time. I forget what all the switches stand for off hand, but this code seems to work for me, and it does not close CAD after each file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FOR %%F IN ("C:\MY\FILE\PATH\*.DWG") DO "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /I "%%F" /S "&lt;SPAN&gt;C:\&lt;/SPAN&gt;&lt;SPAN&gt;MY&lt;/SPAN&gt;&lt;SPAN&gt;\&lt;/SPAN&gt;&lt;SPAN&gt;FILE&lt;/SPAN&gt;&lt;SPAN&gt;\&lt;/SPAN&gt;&lt;SPAN&gt;PATH&lt;/SPAN&gt;\MyScript.scr" /L en-US&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 21:00:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451043#M130381</guid>
      <dc:creator>redtransitconsultants</dc:creator>
      <dc:date>2016-07-20T21:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451059#M130382</link>
      <description>&lt;P&gt;That is just how this method works, the batch file starts autocad and cannot move onto the next file until it receives a signal that Autocad has closed again, if you want to run this script from within an open Autocad session you will be better of learning one of the programming languages within Autocad such as LISP, though I do believe there is a built in method for running a batch file within Autocad (the full version, I use LT so I can't help you on that) try looking at Autocad's scriptpro.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 21:05:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451059#M130382</guid>
      <dc:creator>steven-g</dc:creator>
      <dc:date>2016-07-20T21:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451474#M130383</link>
      <description>&lt;P&gt;Thanks for the quick response.&lt;/P&gt;&lt;P&gt;I tried the solution a few moments ago and it worked perfectly.&lt;/P&gt;&lt;P&gt;Having seen the benefits of this I think I might now experiment with other script functions.&lt;/P&gt;&lt;P&gt;The next idea I have is to try and use the file name and insert this into an attribute.&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 03:41:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451474#M130383</guid>
      <dc:creator>TDD</dc:creator>
      <dc:date>2016-07-21T03:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451481#M130384</link>
      <description>&lt;P&gt;Thanks for the reply, I will look into Scriptpro as you suggested.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 03:42:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6451481#M130384</guid>
      <dc:creator>TDD</dc:creator>
      <dc:date>2016-07-21T03:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6462894#M130385</link>
      <description>&lt;P&gt;I posted an example of AcCoreConsole &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/accoreconsole-noob/m-p/6451047#U6451047" target="_self"&gt;usage in another post&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 17:43:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/6462894#M130385</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-27T17:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/9193286#M130386</link>
      <description>&lt;P&gt;Hello from France,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the SuperAutoScript program from CADERIX&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.caderix.com/telechargement_autocad.html" target="_blank" rel="noopener"&gt;Download SuperAutoScript&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's very easy to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 13:29:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/9193286#M130386</guid>
      <dc:creator>Y.AUBRY</dc:creator>
      <dc:date>2019-12-10T13:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/9194910#M130387</link>
      <description>&lt;P&gt;Going back to the use of a script in autocad using say&amp;nbsp; Scriptpro, or for me its old fashioned DOS&amp;nbsp;&lt;/P&gt;&lt;P&gt;DIR *.dwg /b &amp;gt;Dirdwg.scr This makes a list of dwg names. I use Word to create the script you can replace the end of para ^p with lines of code so repeating what is required.&lt;/P&gt;&lt;P&gt;I would also make all the commands to be executed to be a lisp. Lisps can be called from scripts so long as no use input required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so my script would be and Autocad stays open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Open dwg1
(load "mylisp with all the steps")
Close Y
Open dwg2
(load "mylisp with all the steps")
Close Y
Open dwg2
(load "mylisp with all the steps")
Close Y&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 03:36:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/9194910#M130387</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2019-12-11T03:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/12409064#M130388</link>
      <description>&lt;P&gt;Revisiting this years later...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone advise how to make Autocad close automatically so that the batch file continues? Currently when I run my batch file (which runs a script performing several basic clean functions, qsave, and then close) it opens a file, performs the script, closes the file but not the program session and the batch file waits until Autocad is fully closed.&amp;nbsp; A user has to manually close the Autocad window so that the batch moves onto the next file. For those who successfully have it automated, what might be incorrect in my batch or perhaps Autocad variable settings?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have and know:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Batch Contents:&lt;UL&gt;&lt;LI&gt;FOR %%f IN (Drawing Directory\*.dwg) DO start /wait C:\"Program Files"\"Autodesk"\"AutoCAD 2023"\acad.exe "%%f" /b Name of Script.scr&lt;UL&gt;&lt;LI&gt;Removing the "/wait" works however it opens a new session of Autocad per drawing so ultimately multiple Autocad windows which is prone to resource intensive conditions and crashing.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Whether I end my script with Close, Quit, or nothing, it doesn't change anything. The file closes but the Autocad session/window is still open.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 18:58:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/12409064#M130388</guid>
      <dc:creator>rvtquestions</dc:creator>
      <dc:date>2023-11-29T18:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Batch file for script problem</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/12412033#M130389</link>
      <description>&lt;P&gt;Using scripts it was intended to have Autocad open at all times, using a batch file&amp;nbsp; is probably the problem. You can use lisp to make a script file that has the open dwgname line at start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look into using accoreconsole it will run in the batch file method.&lt;/P&gt;&lt;P&gt;&lt;A href="https://autocadtips1.com/2013/01/30/up-and-running-with-the-2013-core-console/" target="_blank"&gt;https://autocadtips1.com/2013/01/30/up-and-running-with-the-2013-core-console/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 22:40:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/m-p/12412033#M130389</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-11-30T22:40:12Z</dc:date>
    </item>
  </channel>
</rss>

