Trapping Exit of AutoCAD

Trapping Exit of AutoCAD

Anonymous
Not applicable
374 Views
9 Replies
Message 1 of 10

Trapping Exit of AutoCAD

Anonymous
Not applicable
In r12 selecting Exit AutoCAD under the File menu actually invoked the Quit command. By redefining this command I was able to prompt the user to make sure the drawing was saved when certain conditions were detected.

In A2k selecting Exit under the File menu doesn't seem to call the Quit command. My redefinition won't work. Is there a way to trap an attempt to exit AutoCAD and display my custom dialog as I was able to do with r12?
0 Likes
375 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
I discovered a slick workaround for this problem!

Look at the line for Exit in the ACAD.mns file:
ID_APP_EXIT [E&xit]

If you look at the ***HELPSTRINGS section, there is _no_ ID_APP_EXIT listed.
I found that if you change that helpstring on that line to something else,
e.g. ID_My_Exit, you can undefine Exit & roll your own! This also works for
the Close menu item.

--
R. Robert Bell, MCSE
Network Administrator (or, Modern-day Wizard)

dcleghorn wrote in message
news:[email protected]...
| In r12 selecting Exit AutoCAD under the File menu actually invoked the
Quit command. By redefining this command I was able to prompt the user to
make sure the drawing was saved when certain conditions were detected.
|
| In A2k selecting Exit under the File menu doesn't seem to call the Quit
command. My redefinition won't work. Is there a way to trap an attempt to
exit AutoCAD and display my custom dialog as I was able to do with r12?
0 Likes
Message 3 of 10

Anonymous
Not applicable
This doesn't really solve the problem. There are a
few other ways to terminate AutoCAD which don't use
any commands (e.g., clicking the X in the caption
bar for example).

Unfortunately, command redefinition is not the
solution here.

"R. Robert Bell" wrote:
>
> I discovered a slick workaround for this problem!
>
> Look at the line for Exit in the ACAD.mns file:
> ID_APP_EXIT [E&xit]
>
> If you look at the ***HELPSTRINGS section, there is _no_ ID_APP_EXIT listed.
> I found that if you change that helpstring on that line to something else,
> e.g. ID_My_Exit, you can undefine Exit & roll your own! This also works for
> the Close menu item.
>
> --
> R. Robert Bell, MCSE
> Network Administrator (or, Modern-day Wizard)
>
> dcleghorn wrote in message
> news:[email protected]...
> | In r12 selecting Exit AutoCAD under the File menu actually invoked the
> Quit command. By redefining this command I was able to prompt the user to
> make sure the drawing was saved when certain conditions were detected.
> |
> | In A2k selecting Exit under the File menu doesn't seem to call the Quit
> command. My redefinition won't work. Is there a way to trap an attempt to
> exit AutoCAD and display my custom dialog as I was able to do with r12?

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* [email protected] */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 4 of 10

Anonymous
Not applicable
Yes, it only solves the pull-down menu pick. I thought I had tested it, the
first time I discovered this feature, with the X button, but I guess not.
:-(

Oh, come on, Tony, wasn't it cool?! Who would have thought changing the help
string would change the behavior of those two menu selections?

--
R. Robert Bell, MCSE
Network Administrator (or, Modern-day Wizard)

Tony Tanzillo wrote in message
news:[email protected]...
| This doesn't really solve the problem. There are a
| few other ways to terminate AutoCAD which don't use
| any commands (e.g., clicking the X in the caption
| bar for example).
|
| Unfortunately, command redefinition is not the
| solution here.
|
| "R. Robert Bell" wrote:
| >
| > I discovered a slick workaround for this problem!
| >
| > Look at the line for Exit in the ACAD.mns file:
| > ID_APP_EXIT [E&xit]
| >
| > If you look at the ***HELPSTRINGS section, there is _no_ ID_APP_EXIT
listed.
| > I found that if you change that helpstring on that line to something
else,
| > e.g. ID_My_Exit, you can undefine Exit & roll your own! This also works
for
| > the Close menu item.
| >
| > --
| > R. Robert Bell, MCSE
| > Network Administrator (or, Modern-day Wizard)
| >
| > dcleghorn wrote in message
| > news:[email protected]...
| > | In r12 selecting Exit AutoCAD under the File menu actually invoked the
| > Quit command. By redefining this command I was able to prompt the user
to
| > make sure the drawing was saved when certain conditions were detected.
| > |
| > | In A2k selecting Exit under the File menu doesn't seem to call the
Quit
| > command. My redefinition won't work. Is there a way to trap an attempt
to
| > exit AutoCAD and display my custom dialog as I was able to do with r12?
|
| --
| /*********************************************************/
| /* Tony Tanzillo Design Automation Consulting */
| /* Programming & Customization for AutoCAD & Compatibles */
| /* ----------------------------------------------------- */
| /* [email protected] */
| /* http://ourworld.compuserve.com/homepages/tonyt */
| /*********************************************************/
0 Likes
Message 5 of 10

Anonymous
Not applicable
Robert;

It's good to know that. Maybe dcleghorn will benefit
directly. For fun, did you notice whether you can re-define
File/New also? (I've done very little menu customization.)
For myself, I'm trying reactors for my current task.
The :vlr-beginClose reactor seems to trap all these variations
of the close event:

1. if SDI=0, File/Close (the drawing containing the reactor)
File/Exit
Window "exit" button

2. if SDI=1, File/Close
File/Exit
File/New
Window "exit" button

joe

----- Original Message -----
From: "R. Robert Bell"
Newsgroups: autodesk.autocad.customization
Sent: Tuesday, April 25, 2000 2:21 PM
Subject: Re: Trapping Exit of AutoCAD

> I discovered a slick workaround for this problem!
>
> Look at the line for Exit in the ACAD.mns file:
> ID_APP_EXIT [E&xit]
>
> If you look at the ***HELPSTRINGS section, there is _no_ ID_APP_EXIT
listed.
> I found that if you change that helpstring on that line to something else,
> e.g. ID_My_Exit, you can undefine Exit & roll your own! This also works
for
> the Close menu item.
>
> --
> R. Robert Bell, MCSE
> Network Administrator (or, Modern-day Wizard)
>
> dcleghorn wrote in message
> news:[email protected]...
> | In r12 selecting Exit AutoCAD under the File menu actually invoked the
> Quit command. By redefining this command I was able to prompt the user to
> make sure the drawing was saved when certain conditions were detected.
> |
> | In A2k selecting Exit under the File menu doesn't seem to call the Quit
> command. My redefinition won't work. Is there a way to trap an attempt to
> exit AutoCAD and display my custom dialog as I was able to do with r12?
>
0 Likes
Message 6 of 10

Anonymous
Not applicable
File/New is easy. No jumping thru hoops (or menu edits) required. Just
Undefine New, then create your own (defun C:New () . . .)

One of these days, I'm going to have to start some serious development on
reactors. Wish I had only 1,000 things to do, instead of millions! Maybe if
I change my title from "Net Admin" to "At Home, Don't Bother Me,
Programmer"? . . .

--
R. Robert Bell, MCSE
Network Administrator (or, Modern-day Wizard)

Joe Funk wrote in message
news:[email protected]...
| Robert;
|
| It's good to know that. Maybe dcleghorn will benefit
| directly. For fun, did you notice whether you can re-define
| File/New also? (I've done very little menu customization.)
| For myself, I'm trying reactors for my current task.
| The :vlr-beginClose reactor seems to trap all these variations
| of the close event:
|
| 1. if SDI=0, File/Close (the drawing containing the reactor)
| File/Exit
| Window "exit" button
|
| 2. if SDI=1, File/Close
| File/Exit
| File/New
| Window "exit" button
|
| joe
|
0 Likes
Message 7 of 10

Anonymous
Not applicable
"R. Robert Bell" wrote:
>
> Oh, come on, Tony, wasn't it cool?! Who would have thought changing the help
> string would change the behavior of those two menu selections?

I don't think it has anything to do with the helpstring or the
command named "EXIT" (that command is not issued when you pick
File|Exit).

It's the menu item identifier "ID_APP_EXIT" that associates
the action with the menu item. This action, along with a
number of others on the file menu, are "hard-wired", so by
changing "ID_APP_EXIT", you're changing the hard-wired macro
that's associated with the File|Exit menu item, that's all.

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* [email protected] */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 8 of 10

Anonymous
Not applicable
That's what I meant (not what I said)

--
R. Robert Bell, MCSE
Network Administrator (or, Modern-day Wizard)

Tony Tanzillo wrote in message
news:[email protected]...
| I don't think it has anything to do with the helpstring or the
| command named "EXIT" (that command is not issued when you pick
| File|Exit).
|
| It's the menu item identifier "ID_APP_EXIT" that associates
| the action with the menu item. This action, along with a
| number of others on the file menu, are "hard-wired", so by
| changing "ID_APP_EXIT", you're changing the hard-wired macro
| that's associated with the File|Exit menu item, that's all.
|
0 Likes
Message 9 of 10

Anonymous
Not applicable
My advice is to avoid command redefinition. You're taking
the right approach with reactors.

Joe Funk wrote:
>
> Robert;
>
> It's good to know that. Maybe dcleghorn will benefit
> directly. For fun, did you notice whether you can re-define
> File/New also? (I've done very little menu customization.)
> For myself, I'm trying reactors for my current task.
> The :vlr-beginClose reactor seems to trap all these variations
> of the close event:
>
> 1. if SDI=0, File/Close (the drawing containing the reactor)
> File/Exit
> Window "exit" button
>
> 2. if SDI=1, File/Close
> File/Exit
> File/New
> Window "exit" button
>
> joe
>
> ----- Original Message -----
> From: "R. Robert Bell"
> Newsgroups: autodesk.autocad.customization
> Sent: Tuesday, April 25, 2000 2:21 PM
> Subject: Re: Trapping Exit of AutoCAD
>
> > I discovered a slick workaround for this problem!
> >
> > Look at the line for Exit in the ACAD.mns file:
> > ID_APP_EXIT [E&xit]
> >
> > If you look at the ***HELPSTRINGS section, there is _no_ ID_APP_EXIT
> listed.
> > I found that if you change that helpstring on that line to something else,
> > e.g. ID_My_Exit, you can undefine Exit & roll your own! This also works
> for
> > the Close menu item.
> >
> > --
> > R. Robert Bell, MCSE
> > Network Administrator (or, Modern-day Wizard)
> >
> > dcleghorn wrote in message
> > news:[email protected]...
> > | In r12 selecting Exit AutoCAD under the File menu actually invoked the
> > Quit command. By redefining this command I was able to prompt the user to
> > make sure the drawing was saved when certain conditions were detected.
> > |
> > | In A2k selecting Exit under the File menu doesn't seem to call the Quit
> > command. My redefinition won't work. Is there a way to trap an attempt to
> > exit AutoCAD and display my custom dialog as I was able to do with r12?
> >

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* [email protected] */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 10 of 10

Anonymous
Not applicable
If only reactors weren't such a PITA with VLisp... 😞

--
R. Robert Bell, MCSE
Network Administrator (or, Modern-day Wizard)

Tony Tanzillo wrote in message
news:[email protected]...
| My advice is to avoid command redefinition. You're taking
| the right approach with reactors.
|
0 Likes