Hi John, here is a simple and easy code for You to modify. It generate one scriptfile including dwg files in a selected directory and command lines to execute on each of them.
Code:
(defun c:MakeMyScript ( / UserFile UserCat FileList File#1 Index FileName )
(vl-load-com )
(setq UserFile (getfiled "Find the the catalog with the drawings to process, and pick one file" "*.*" "*" 16 ) )
(setq UserCat (vl-filename-directory UserFile ) )
(setq FileList (vl-directory-files UserCat "*.dwg" 1 ) )
; ^- those 3 command lines generate a list like ("chroma.dwg" "direct.dwg" "overhead.dwg" "rm_sdb.dwg" "sh_spot.dwg")
; then You need lines, a list or a txt file with the commands to execute on each drawing
; make a while loop and step trough the file list and add the command lines to each file while writing to the script file
(setq File#1 (open "c:/MyTest.scr" "w" ) ) ;; open/make a scriptfile to write to
(setq Index 0 )
(while (setq FileName (nth Index FileList ) ) ;; loop trough every dwg in FilList
(princ (strcat "open " FileName "\n" ) File#1 )
;; write Your command lines here , those lines is NOT tested to run
(princ "._zoom ext \n" File#1 )
(princ "._-layer s 0 \n" File#1 )
(princ "close Yes or No \n" File#1 )
(setq Index (1+ Index ) ) ;; prepare for next file to loop
)
(close File#1 )
(princ "open c:/MyTest.scr and look at it" )
(startapp "NOTEPAD" "c:/MyTest.scr" )
(princ)
)
: ) Happy Computing !
kennet