batch commands, how to...

batch commands, how to...

christophercoss
Explorer Explorer
323 Views
3 Replies
Message 1 of 4

batch commands, how to...

christophercoss
Explorer
Explorer

I have no experience with batch commands, but would like to learn how to create a 'simple' one.

I need it to spell check, purge and then save the file once i decide to close it.

 

Is this even a batch command?

 

As usual, all help is appreciated.  Thanks,

Chris

0 Likes
324 Views
3 Replies
Replies (3)
Message 2 of 4

pendean
Community Legend
Community Legend
while you wait... did you experiment with the built-in Action Recorder yet
https://www.autodesk.com/blogs/autocad/action-macros-in-autocad/
0 Likes
Message 3 of 4

Moshe-A
Mentor
Mentor

@christophercoss  hi,

 

Here is a nice and simple AutoLLISP command to do what you want.

spell command is not good example to use batch cause it requires user involvement (the batch is paused until you close spell dialog box) but to learn AutoLISP you need to take basic course and explore the basic functions.

 

Moshe

 

(defun c:MyBatch ()
 (command "._spell") ; invoke spell command

 (if (= (getvar "diastat") 1) ; test if dialog box exist ok?
  (progn
   (command "._purge" "_all" "*" "_No") ; invoke purge command

   (if (not (wcmatch (getvar "dwgname") "Drawing*")) ; test if drawing already has a name?
    (command "._qsave") ; invoke qsave command
    (princ "\nDrawing does not have a name.")
   )
  ); progn
 ); if


 (princ) ; quiet exit autolisp command
); c:MyBatch

 

0 Likes
Message 4 of 4

Sea-Haven
Mentor
Mentor

I tried this seemed to work. The command-s means must finish spell. 

 

 

(defun c:MyBatch ()
 (command-s "._spell") ; invoke spell command
   (command "._purge" "_all" "*" "_No") ; invoke purge command
   (if (not (wcmatch (getvar "dwgname") "Drawing*")) ; test if drawing already has a name?
    (command-s "._qsave") ; invoke qsave command
    (princ "\nDrawing does not have a name.")
   )
)

 

 

Not tested fully.

0 Likes