1.

Solve : batch file to run with the program only opening once?

Answer»

Hello All, my name is todd and this is my first post besides my introduction. great resource here. My issue is that I have a .bat file that RUNS with a .lsp and a .scr file that I run with autocad to purge multiple drawings. It works great but the problem is that it opens autocad runs the routine and closes and then opens again on the next drawing. Is there a way that I can write it to only open autocad once and perform the tasks? An additional question #2 does the .bat , .scr, .lsp files need to be in the same folder that I am performing the processes on? I have TRIED calling to it from another folder location and it doesnt seem to be able to find the file? If it would be helpful I will attach the files that I have so that you can look at them. I appreciate all of your assistance in advance.The files don't have to be in the same location to work correctly.

What version of AutoCad are you using?im using autocad 2008. I am pretty sure I directed them to the correct file path. I copied it from the search window and placed "" around folders with spaces in them. Does it have a hard time searching through sub-folders?anyone??No It shouldn't have a problem going thru the sub-folders but seems that you can open multiple drawings in one window, from here it seems that the multiple file opening is different from previous versions.

Post your batch script you have so far.Quote from: todouble22 on January 07, 2010, 09:41:55 AM

An additional question #2 does the .bat , .scr, .lsp files need to be in the same folder that I am performing the processes on? I have tried calling to it from another folder location and it doesnt seem to be able to find the file?

If possible show the complete path to all .exe and data files in the batch files and other files. If that does not work show all paths in the system search path: Path. If that does not work reinstall the main programs. ( some of the paths to .exe and data files might be corrupt. ) good luck.Quote from: macdad- on January 08, 2010, 09:11:12 AM
No It shouldn't have a problem going thru the sub-folders but seems that you can open multiple drawings in one window, from here it seems that the multiple file opening is different from previous versions.

Post your batch script you have so far.
are you familiar with autocad at all? you want me to post the batch, script, and lisp files that I am using?Yes I am familiar with it.

And yes please post atleast the batch scriptQuote from: macdad- on January 13, 2010, 06:07:09 PM
Yes I am familiar with it.

And yes please post atleast the batch script
this is the batch file:
MD C:\TEST\DWG\NEWBORDER
For %%f in (C:\TEST\DWG\*.dwg) do start /wait C:\"Program Files"\Autodesk\"Acade 2008"\acad.exe "%%f" /b C:\TEST\tsi-D_borderrev.scrYour batch file looks right.

But it seems that you can't open a new drawing in ACad from command line(batch script).

Please post the Acad Script, from the Acad Script it seems that you can open up another drawing without closing the current Acad window all together.Quote from: macdad- on January 16, 2010, 11:10:38 AM
Your batch file looks right.

But it seems that you can't open a new drawing in ACad from command line(batch script).

Please post the Acad Script, from the Acad Script it seems that you can open up another drawing without closing the current Acad window all together.
The script is pretty extensive since it updates all the attributes in a title block but here it is:
Script:
;THIS SCRIPT WILL ZOOM TO EXTENTS AND CYCLE THROUGH THE ATTRIBUTES ONE AT A TIME WITH THE ABILITY TO CHANGE THEM BY THEIR LOCATION REGARDLESS OF
;WHAT IS THERE FOR TEXT AND MAKE THE REPLACEMENT AS TO WHAT IS PUT INTO THIS SCRIPT
;IT WILL THEN LOAD THE LISP AND SAVE THE UPDATED DRAWING INTO THE NEWBORDER FOLDER AND LEAVE THE ORIGINAL UNCHANGED
;WHEN RUN BY THE BATCH FILE AND INCLUDING THE LISP IT WILL UPDATE THE ATTRIBUTES AND SAVE THE UPDATED DRAWING INTO THE NEWBORDER FOLDER AND LEAVE
;THE ORIGINAL AS IT WAS
;THIS SCRIPT CAN BE MODIFIED TO ADD IN THE X FOR PRELIMINARY OR APPROVED FOR CONSTRUCTION AS WELL
;CREATED BY TODD PERKINS 2009
zoom
e
;THE FOLLOWING IS THE SEQUENCE OF EDITING THE ATTRIBUTES ONE AT A TIME THE COMMENTS ARE THE PROMPTS THAT COINCIDE WITH THE COMMAND
-attedit
;Edit attributes one at a time
y
;Enter block name specification
TSI-D
;Enter attribute TAG specification
TITLE1
;Enter attribute value specification THIS USES THE WILDCARD * TO MAKE IT VARIABLE TO WHAT IS THERE FOR TEXT AS THE ATTRIBUTE TO BE CHANGED
*
;Expects a point or Window/Last/Crossing/BOX/Fence/WPolygon/CPolygon
w
;0,0 SPECIFIES FIRST CORNER
0,0
;GETVAR SPECIFIES THE OPPOSITE CORNER
(getvar "limmax")
;Enter an option [Value/Position/Height/Angle/Style/Layer/Color/Next]
v
;Enter type of value modification [Change/Replace]
r
;Enter new attribute value
FIRST LINE OF TITLE
;AN ENTER IS PLACED HERE AND THEN REPEATS THE PROCESS TO EDIT THE REST OF THE ATTRIBUTES ONE AT A TIME

-attedit
y
TSI-D
TITLE2
*
w
0,0
(getvar "limmax")
v
r
SECOND LINE OF TITLE

-attedit
y
TSI-D
TITLE3
*
w
0,0
(getvar "limmax")
v
r
THIRD LINE OF TITLE

-attedit
y
TSI-D
SCALE
*
w
0,0
(getvar "limmax")
v
r
1:1

-attedit
y
TSI-D
DRAWN
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
DRAWDATE
*
w
0,0
(getvar "limmax")
v
r
00/00/00

-attedit
y
TSI-D
DESIGNED
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
DESDATE
*
w
0,0
(getvar "limmax")
v
r
00/00/00

-attedit
y
TSI-D
ENG1
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
ENG1DATE
*
w
0,0
(getvar "limmax")
v
r
00/00/00

-attedit
y
TSI-D
ENG2
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
ENG2DATE
*
w
0,0
(getvar "limmax")
v
r
00/00/00

-attedit
y
TSI-D
MGR
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
MGRDATE
*
w
0,0
(getvar "limmax")
v
r
00/00/00

-attedit
y
TSI-D
DWGNO
*
w
0,0
(getvar "limmax")
v
r
10000

-attedit
y
TSI-D
REVNO
*
w
0,0
(getvar "limmax")
v
r
A

-attedit
y
TSI-D
TSIJOB
*
w
0,0
(getvar "limmax")
v
r
10000

-attedit
y
TSI-D
TSICADD
*
w
0,0
(getvar "limmax")
v
r
10000

-attedit
y
TSI-D
REVNO1
*
w
0,0
(getvar "limmax")
v
r
1

-attedit
y
TSI-D
REVDATE
*
w
0,0
(getvar "limmax")
v
r
00/00/00

-attedit
y
TSI-D
REVDESC
*
w
0,0
(getvar "limmax")
v
r
FOR REVIEW

-attedit
y
TSI-D
REVBY
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
REVAPP
*
w
0,0
(getvar "limmax")
v
r
TJP

-attedit
y
TSI-D
REVNO2
*
w
0,0
(getvar "limmax")
v
r
A

-attedit
y
TSI-D
ISSUETO
*
w
0,0
(getvar "limmax")
v
r
CLIENT

-attedit
y
TSI-D
ISSUEFOR
*
w
0,0
(getvar "limmax")
v
r
REVIEW

;THIS IS TO PURGE AND REGENERATE THE DRAWING
-purge
a
*
n
regen
(load "C:\\TEST\\TBUPDATE.LSP")
TBUPDATE
QUIT
Y
** I think I can change the quit here to close but it hasnt worked in the past. As you can see the script file calls the lisp which saves the drawing to a new folder with the same drawing name. but here is the lisp file also.
l;THIS LISP IS CREATED TO UPDATE THE DRAWING IN THE SELECTED FILES IN THE SCRIPT AND SAVE THEM INTO THE NEWBORDER FOLDER WITH THE SAME NAME AND
;LEAVE THE ORIGINAL UNCHANGED
;CREATED BY TODD PERKINS 2009
(defun C:TBUPDATE(/ dn pa panbdn) ;THIS LINE DEFINES THE COMMAND TBUPDATE
(setq dn (getvar "dwgname")) ;THIS LINE GETS THE NAME OF THE CURRENT DRAWING FILE AND SAVES IT TO A VARIABLE NAMED dn
(setq pa (getvar "dwgprefix")) ;THIS LINE GETS THE PATH OF THE CURRENT DRAWING FILE AND SAVES IT TO THE VARIABLE NAMED pa
(setq panbdn (strcat pa "NEWBORDER\\" dn)) ;THIS LINE CREATES A NEW PATH BY ADDING NEWBORDER\\ TO THE EXISTING PATHS WHERE DRAWINGS ARE SAVED
(command "SAVE" panbdn) ;THIS LINE SAVES THE DRAWING IN THE NEWBORDER FOLDER USING THE SAME DRAWING NAME
) ;THIS LINE CLOSES THE OPENING PARENTHESIS IN THE FILEisp:

Alright here we go.

Now when you tried the Close command what did it do?


Discussion

No Comment Found