PDA

View Full Version : about MGlobal::executeCommand


stao
07-04-2008, 03:08 AM
Hi,

I am totally lost and "depressed" :) Command below could be correctly executed in Maya Script Editor. But it fails when I tried to run it in program.

int main(int argc, char **argv)
{
MStatus status;
status = MLibrary::initialize (true, argv[0], true);
if ( !status ) {
status.perror("MLibrary::initialize");
return (1);
}

// ONLY lines I added to c:\Program Files\Alias\Maya8.0\devkit\applications\helloWorld.cpp
const char* fixedname = "C:/t.mb";
MString tmp = MString("file -open -force -loadAllReferences \"") + fixedname + "\"";
status = MGlobal::executeCommand( tmp );
_ASSERTE( status );

// Write the text out in 3 different ways.
cout << "Hello World! (cout)\n";
MGlobal::displayInfo("Hello world! (script output)" );
MGlobal::executeCommand( "print \"Hello world! (command script output)\\n\"", true );
MLibrary::cleanup();
return (0);
}

Maya 8, Windows XP sp2

stao
07-04-2008, 02:49 PM
Looks like this problem is a bug of Maya 8.0. I tried the same thing on Maya 8.5. The call succeeded without any problem.

CGTalk Moderation
07-04-2008, 02:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.