Fixing an Autodesk Batch Save Utility script error when using Autolisp
Last week I introduced the Autodesk Batch Save Utility which installs as part of Civil 3D 2019. I am hoping many of you have given it a try in an effort to perhaps clean your older drawings.
I did, however, discover an possible error you may receive using one of the sample scripts, and I would like to address how to fix it, and maybe give you an insight into creating your own scripts for your use.
The Autodesk Batch Save Utility comes with some pre-made custom scripts which are found in C:\ProgramData\Autodesk\C3D 2019\BatchSaveTool\Scripts. One of these scripts is called "defaultClean.scr" which runs an autolisp routine to Purge and Audit your drawings as the Batch Save Utility opens and saves each, in turn.
The error is that the drawings never save and the routine fails to clean your drawing data as intended as shown by this sample error:
Let's take a look at the script:
It's fairly simple. Load and run "defaultClean.lsp" which Audits and Purges the drawing saving between each command, set the system variable FILEDIA to 1, close and answer a prompt Y (Yes), then quit.
It should work, but it doesn't. If I look at the error log, it becomes apparent what is happening. (You will find the error logs in C:\BatchSaveLog\DetailLog.)
It cannot load the autolisp file! This one took me a bit to nail down but I found the issue.
If you only have Civil 3D 2019 installed, there should be no issue and the script should run normally. However, if you have AutoCAD 2019 also installed along with Civil 3D 2019, the script may fail. The reason? The installation adds the path C:\ProgramData\Autodesk\C3D 2019\BatchSaveTool\Scripts to both the "Support File Search Path" and "Trusted Locations" sections of your Civil 3D 2019 Options tab, but does not do it for plain AutoCAD 2019.
Since the tools runs "C:\Program Files\Autodesk\AutoCAD 2019\accoreconsole.exe" it seems to be using the plain AutoCAD 2019 profile instead of the Civil 3D 2019 one. I added "C:\ProgramData\Autodesk\C3D 2019\BatchSaveTool\Scripts" to my plain AutoCAD 2019 profile in the "Support File Search Path" and "Trusted Locations" sections, and SUCCESS!
I hope this little journey helps some of you out there who may have issues running scripts with Autolisp functions using the Autodesk Batch Save Utility.
If you have any questions on this, or would like more information, please contact me at [email protected].