Author Topic: macro help  (Read 1230 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
macro help
« on: January 06, 2006, 12:42:23 PM »
i'm wondering what would a macro look like for closeall without saving and closeall with saving?

hyposmurf

  • Guest
Re: macro help
« Reply #1 on: January 06, 2006, 03:07:34 PM »
I thought by changing filedia to 0 it would suppress the save dialogue box so you could add options for closing without saving.But the save dialogue box appears to be one of those that you cant suppress. Someone will probably come along with a lisp that wil do what you want. :-) You used the QQUIT command that seems dam nifty.

ELOQUINTET

  • Guest
Re: macro help
« Reply #2 on: January 06, 2006, 03:24:06 PM »
a coworker of mine opens and prints alot of drawings and wants a quick way to be able to close all of them without being prompted

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: macro help
« Reply #3 on: January 06, 2006, 03:29:14 PM »
Can't you hold down something like the shift key when you click yes or no and it does all of them?

ELOQUINTET

  • Guest
Re: macro help
« Reply #4 on: January 06, 2006, 05:41:28 PM »
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.

Code: [Select]
(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
)

ELOQUINTET

  • Guest
Re: macro help
« Reply #5 on: January 09, 2006, 12:37:09 PM »
anyone have any advice on this i still haven't been able to get this to work?