not working here greg. i was trying to piece together something from autodesk forum but can't seem to get it, anyone?
Re: Need help with a "save all, close all, & exit acad" lisp ro
Kelly,
Put these functions in a file called bye.lsp and save it in your search
path. In your toolbar:
^C^C^P(progn(load "bye")(c:bye)) ^P
or some such, somebody fix this, I don't do toolbars anymore.
(defun c:bye ()
(c:cas)
(if (not (zerop (getvar "dbmod")))
(command "._qsave")
)
(command "._quit")
)
(defun c:cas ( / cnt) ;SAVES AND CLOSES ALL DOCUMENTS EXCEPT THE ACTIVE
(setq cnt (doc:CloseAllButActive :vlax-True))
(if (> cnt 0)
(princ (strcat "\n(" (itoa cnt) ") document" (if (= cnt 1) "" "s") " saved
and closed."))
(princ "\nNo documents were closed.")
)
(princ)
)
;doc:CloseAllButActive_____________________________________<[color=Red]<<<<<<not sure if this belongs??[/color] _________________
_____________
;Close all except active document with or without saving
;Argument 1) :vlax-True or :vlax-False
; Use :vlax-True to save and close, :vlax-False for close without
saving
;Returns number of documents that were closed
(defun doc:CloseAllButActive (TrueOrFalse / cnt name)
(setq cnt 0)
(vlax-for Item (vla-get-Documents (vlax-get-acad-object))
(if (= (vla-get-Active Item) :vlax-False)
(progn
(setq
name (vla-get-fullname item)
name (if (= name "") (vla-get-name item) name) ;IF NOT SAVED YET USE
FILE NAME ONLY
)
(princ (strcat "\nClosing -> " name))
(if
(vl-catch-all-error-p
(setq error-object (vl-catch-all-apply 'vla-close (list Item
TrueOrFalse)))
)
(progn
(setq cnt (1- cnt))
(princ (vl-catch-all-error-message error-object))
)
)
(setq cnt (1+ cnt))
)
)
)
cnt
)