raw_AfterCommandRun and "Save a copy" command - how to know new filename?

Valued Contributor
Valued Contributor

 

Hi,

 

  I am using the raw_BeforeCommandRun and raw_AfterCommandRun to trap when a user is performing a "Save As" on a component. - I then remove certain parameters from the new component.

 

  However, I also want to remove those parameters from the new component, if they have used the "Save A Copy" on a component.  However, the raw_AfterCommandRun will not know the file that they have just saved the copy as - and there doesn't appear to be any other event that I can catch to find it out.

 

  Does anyone have any suggestions on where I can look to find the new filename?

Thanks,

Chris.

 

 

 

Posted by: chris mann
Post date: 9/25/2008 7:10:46 AM

3 REPLIES

RE: raw_AfterCommandRun and "Save a copy" command - how to know new filename?

Valued Contributor
Valued Contributor

Chris,

 

I haven't tested it, but you may look at the BeforeDocumentSave event (from the ApplicationEvents). This event gets typically fired, if a document is going to be saved. I am not sure, if you can trap a Save As and Save Copy As, as well. If so, you could try to find out, if the document's name has already been changed.

It's worth a try...

 

Martin

 

Posted by: Martin Bernhard
Post date: 10/4/2008 4:34:04 AM

RE: raw_AfterCommandRun and "Save a copy" command - how to know new filename?

Valued Contributor
Valued Contributor

 

Chris,

 

today I have tested it and can confirm my comments on the SaveAs command. If you call the SaveAs command on a Part document, you will receive the BeforeCommandRun event with the PartFileSaveAs command ID (=57604) and a subsequent BeforeDocumentSave event with the document already changed to its new filename.

Unfortunately, the SaveCopyAs command does not fire a BeforeDocumentSave event, so that you cannot get the filename of the copied document.

 

Martin

 

Posted by: Martin Bernhard
Post date: 10/5/2008 4:50:29 AM

RE: raw_AfterCommandRun and "Save a copy" command - how to know new filename?

Valued Contributor
Valued Contributor

Martin,

 

Thanks for the suggestions and looking into them. - Unfortunately, I dont think I am going to find a way to get the new filename. - Since it doesn't actually get used by SolidEdge until the user (may) chooses (at some time) to go and open it, I think there is probably not any API call that can return me the new name.

 

For the moment, I'm looking at a rather ugly method of setting a param to hold the filename, checking the filename param on load to compare to the actual filename and if different, removing the offending parameters. - But, this causes a change to the model and subsequent save that is required, which in terms of our data management then needs to be stored and maintained!

 

Thanks anyway!

Chris.

 

Posted by: chris mann
Post date: 10/5/2008 10:12:00 PM