.NET

Reply
Active Contributor
davidgarner
Posts: 26
Registered: ‎04-14-2005
Message 1 of 4 (148 Views)

Distinquish SaveAs and Save

148 Views, 3 Replies
05-25-2006 05:30 PM
I'm trying to distinguish the difference between a Save and a SaveAs.

The only events exposed in AutoCAD are BeginSave and SaveComplete. The event args of each provide the new filename.

I want to call a function ONLY if the path or filename is changed during the save.

The only way I can think of is create a global variable when a drawing is activated and store the name of the current drawing. Then when a save is done compare the new name (e.Filename) to the old one.

is there a more elegant way I'm just not finding. (BTW I hate global variables.)
*Tony Tanzillo
Message 2 of 4 (148 Views)

Re: Distinquish SaveAs and Save

05-26-2006 03:33 AM in reply to: davidgarner
One way would be to look at the current command
(the CommandInProgress property of the Document
object)

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5186808@discussion.autodesk.com...
I'm trying to distinguish the difference between a Save and a SaveAs.

The only events exposed in AutoCAD are BeginSave and SaveComplete. The event args of each provide the new filename.

I want to call a function ONLY if the path or filename is changed during the save.

The only way I can think of is create a global variable when a drawing is activated and store the name of the current drawing. Then when a save is done compare the new name (e.Filename) to the old one.

is there a more elegant way I'm just not finding. (BTW I hate global variables.)
Active Contributor
davidgarner
Posts: 26
Registered: ‎04-14-2005
Message 3 of 4 (148 Views)

Re: Distinquish SaveAs and Save

05-26-2006 10:57 AM in reply to: davidgarner
Perfect

Just one line of code:

if( Application.DocumentManager.MdiActiveDocument.CommandInProgress == "SAVEAS" )
{
PerformFunction( e.FileName );
}

Thanks so much for pointing me in the right direction. Much better than a global variable.
*Tony Tanzillo
Message 4 of 4 (148 Views)

Re: Distinquish SaveAs and Save

05-27-2006 06:40 AM in reply to: davidgarner
Remember that the AutoCAD SAVE command (invoked from
the command line) saves the file to another filename, but
does change the current document to that filename.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5187702@discussion.autodesk.com...
Perfect

Just one line of code:

if( Application.DocumentManager.MdiActiveDocument.CommandInProgress == "SAVEAS" )
{
PerformFunction( e.FileName );
}

Thanks so much for pointing me in the right direction. Much better than a global variable.
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.