Page 1 of 1

batch file to edit mutiple drawings

Posted: Wed Feb 08, 2017 8:14 am
by sln8458
I have been looking for a way to edit multiple drawings and perform the same change to each file.
In my case I wanted to purge all the drawings in a project folder and all sub folders without being sat at the computer all day.

I found a few web sites which had options for Autocad, but nothing for Intellicad. So I copied a batch file for autocad and modified it to reflect intellicad.
Here is the code:
FOR %%f in (E:\"0001-PURGE ALL"\*.dwg) do start /wait C:\"Program Files"\"CMS"\"CMS IntelliCAD 8.2 Premium Edition Plus"\Icad.exe "%%f" /b "E:\0001-PURGE ALL\Purge-ALL.scr"

In this case the drawings are located in the folder E:\0001-PURGE ALL.
this is a single line of code copied into a simple text file (using notepad) named PURGEALL.BAT

each drawing is opened in turn and the script file 'Purge-All.scr' is loaded and run. It is in this script file that I defined the Intellicad commands to run.
Here is my script file code, again in a simple text file (notepad again) saved as Purge-All.scr
setvar
filedia
off
purge
all

n
z
e
-save

setvar
filedia
on
quit
y

Note the spaces are intentional as is the empty line after quit/y.
Also, as this is to run 'un-manned' I turned off all dialogue boxes via the system variable 'filedia' to enable the script to run, it is the turned back on when the script has completed but before the save command.

This worked fine but only worked in the root folder, ignoring all sub folders.
I wasn't able to resolve the sub folder issue so resorted to ask for help here: ->https://www.windows10forums.com/threads ... ing.12119/ <- and with the help provided here I was able to re-work the code to run on all the drawings in the project root folder and ALL sub folders.

The revised code:
FOR /r "E:\0001-PURGE ALL\" %%f in (*.dwg) do start /wait C:\"Program Files"\"CMS"\"CMS IntelliCAD 8.2 Premium Edition Plus"\Icad.exe "%%f" /b "E:\0001-PURGE ALL\Purge-ALL.scr"
del *.bak /s

Note: in this file I have added a second line of code "del *.bak /s' this deletes all the back-up files created by the routine in all the project folders.

So if you have a need to modify multiple files with the same change this could work for you, all you need to do is generate your script file for your changes.

Use at your own risk/discretion.
SteveN