.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Distinquish SaveAs and Save

3 REPLIES 3
Reply
Message 1 of 4
davidgarner
268 Views, 3 Replies

Distinquish SaveAs and Save

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.)
3 REPLIES 3
Message 2 of 4
Anonymous
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.)
Message 3 of 4
davidgarner
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.
Message 4 of 4
Anonymous
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.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost