PDA

View Full Version : script output to text file?


doppelganger
10-21-2003, 03:55 AM
Regards all,

I am working on a PERL interface to the render globals under Win2K so users can view and modify render settings without loading maya or waiting for multiple files to load.
I have a small mel script to querry the renderGlobals and read them into an array. it is in my scripts folder and the text follows:

string $globals[] = `listAttr defaultRenderGlobals`;
$globals = `sort $globals`;
print $globals;

So far when I run maya in batch mode wth the following command
mayabatch -batch -file h:\boulder.ma -script "getGlobals.mel" The comand runs fine but no otput makes it to the command shell.

So I edited it with a system call to try and echo the value to a text file like so:
string $globals[] = `listAttr defaultRenderGlobals`;
string $globals = `sort $globals`;
system("echo " + $globals + " > c:\\output.txt");

now I get the error
// Error: Line 3.26: Illegal operation "+" on data of type string[]. //

is this because $globals is actually a string array?

Is there a better way to do this?

any help would be great!

Thanks

Scott Spencer

ajk48n
10-21-2003, 05:31 AM
You could try writing to the file through MEL.

proc writeFile(string $input, string $readWriteArg)
{
$fileName = "D:\Document.txt";
$fileId=`fopen $fileName $readWriteArg`;
fprint $fileId ($input + "\n");
fclose $fileId;
}

CGTalk Moderation
01-16-2006, 09:00 AM
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.