SaveDocument in C++

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/10/2004 at 00:13, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9.012 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hi
When I use following code in COFFEE, if its a new document, save as dialog box (windows default) will open automatically. Whats the relavent code in C++?

    
    
    
    
     var doc=GetActiveDocument(); // COFFEE  
     var f = doc->GetFilename(); // COFFEE  
     doc->Save(f); //COFFEE
    
    
    

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 20/10/2004 at 01:08, xxxxxxxx wrote:

I tried something like this...

    
    
    
    
    doc=GetActiveDocument();  
    Filename fname;  
    fname = doc->GetDocumentName();  
    SaveDocument(doc,fname,FALSE,0);
    
    
    

Is it the right way?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/10/2004 at 12:05, xxxxxxxx wrote:

Hi there,

it should be fine. Does SaveDocument() bring up a filename selector? If not and you want one, you should add

fname.FileSelect(FSTYPE_SCENES, GE_SAVE);

before SaveDocument.

Timm

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/10/2004 at 19:49, xxxxxxxx wrote:

Even though I get the file selector window, "SaveDocument" returns FALSE. Here is my code for your reference

    
    
    
    
     doc=GetActiveDocument();  
     Filename fname;  
     fname.FileSelect(FSTYPE_SCENES, GE_SAVE);  
     if(SaveDocument(doc,fname,FASLE,0))  
       GePrint("TRUE - SUCCESS");  
     else  
       GePrint("FALSE - FAILED");  
    
    
    
    

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/10/2004 at 00:32, xxxxxxxx wrote:

I guess "FASLE" is a typo, otherwise it wouldn't compile? (Please copy/paste code to avoid such typos.)
This code seems to work:

    
    
    doc=GetActiveDocument();   
    Filename fname = doc->GetDocumentPath() + doc->GetDocumentName();   
    fname.FileSelect(FSTYPE_SCENES, GE_SAVE);   
    if(SaveDocument(doc,fname,FALSE, FORMAT_C4DEXPORT))    
    {  
      GePrint("TRUE - SUCCESS");   
    }  
    else     
    {  
      GePrint("FALSE - FAILED");  
    }

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/10/2004 at 02:44, xxxxxxxx wrote:

Mikael,
It works fine, but it exports the currently opened new file (example untitled1.c4d) into the new file name which i specify thro' the file selector. I dont want to export, just want to save the current file. So that after saving I can see the new file (no more untiltled1.c4d) as the current active document.
Please let me if you are not clear with my requirement. I am looking for the functionality of Save function under BaseDocument Object in COFFEE.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/10/2004 at 02:56, xxxxxxxx wrote:

Ok, then I guess you could simply trigger the save menu command:

    
    
    namespace c4d_symbols_coh  
    {  
    #undef IDC_OK  
    #undef IDC_CANCEL  
    #undef IDM_CM_CLOSEWINDOW  
    #undef HOTKEY_CAMERA_MOVE  
    #undef HOTKEY_CAMERA_SCALE  
    #undef HOTKEY_CAMERA_ROTATE  
    #undef HOTKEY_OBJECT_MOVE  
    #undef HOTKEY_OBJECT_SCALE  
    #undef HOTKEY_OBJECT_ROTATE  
    #include "../c4d_symbols.coh"  
    };  
    using namespace c4d_symbols_coh;
    
    
    
    
    Bool MenuTest::Execute(BaseDocument *doc)  
    {  
      BaseContainer msg(COREMSG_CINEMA_EXECUTEEDITORCOMMAND);  
      msg.SetLong(COREMSG_CINEMA_EXECUTEEDITORCOMMAND, IDM_SPEICHERN);  
      Bool result = SendCoreMessage(COREMSG_CINEMA, msg, 0).GetLong();  
      return result;  
    }

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/10/2004 at 19:34, xxxxxxxx wrote:

Yes Mikael, it works now. You are great. Thanks.