Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script to exit dwg without saving

9 REPLIES 9
Reply
Message 1 of 10
MechMan_
1918 Views, 9 Replies

Script to exit dwg without saving

I've typed up a script that runs WBLOCK on a drawing. At the end of the script I want the drawing to close without saving any changes. I've tried using variations of:



(setvar "EXPERT" 2)(command "_.close") y



but the command line always get's stuck at:



Command: Really want to discard all changes to drawing?



How can I get my script to enter "Yes" to discard the changes without saving? It would seem to be such a simple thing to tell Acad to exit without saving but alas I've run into road blocks at every attempt. B-(



MechMan
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: MechMan_

A script? Then why are you using LISP instructions? Try

CLOSE
Y
___

"MechMan" wrote in message news:f18d06d.-1@WebX.maYIadrTaRb...
> I've typed up a script that runs WBLOCK on a drawing. At the end of the
script I want the drawing to close without saving any changes. I've tried
using variations of:
>
>
> (setvar "EXPERT" 2)(command "_.close") y
Message 3 of 10
GvHerk
in reply to: MechMan_

or use (command ".quit" "y")
Message 4 of 10
jlaidler
in reply to: MechMan_

(command "vbastmt" "activedocument.close false")
Message 5 of 10
MechMan_
in reply to: MechMan_

"Then why are you using LISP instructions?"



Because it's the only thing I've found to "almost" work. Your method gives me a window prompt to save & close. That's what I'm trying to avoid. I want to WBLOCK a drawing and have it close at the click of a button.



MechMan
Message 6 of 10
MechMan_
in reply to: MechMan_

Works great to close all of Acad but I'm only wanting to close a single drawing at a time. I tried adapting it to use the "close" command but no dice.



MechMan
Message 7 of 10
MechMan_
in reply to: MechMan_

BINGO!



Thanks jclaidler!



MechMan
Message 8 of 10
Anonymous
in reply to: MechMan_

From the keyboard, yes; from a *script* *no*. Try it.
___

"MechMan" wrote in message news:f18d06d.3@WebX.maYIadrTaRb...
>
> Your method gives me a window prompt to save & close.
Message 9 of 10
jlaidler
in reply to: MechMan_

no problem
Message 10 of 10
MechMan_
in reply to: MechMan_

My apologies Paul. Right you are. I had tested it by just customizing a button with "close;y;" and it gave me prompts. I didn't know that the script would handle it differently.

Thanks.



MechMan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost