XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : batch processing ? how to

11-16-2003, 12:38 PM
hi I would like to be able to batch process any given mel script to any given destination maya file
for instance I would like to be able to:
- apply a script to "20" maya files without the need to open the files one by one ,
- apply the script ,
- save the file.
so my question is : is there allready a mel script or utility program that let me do that out there ? otherwise what would be the best way to script such command,
any help would be greatly appriciated :)

11-16-2003, 07:32 PM
Opening, closing and saving are all MEL commands in Maya. Check the MEL Command Reference for the "file" command

11-16-2003, 10:34 PM
thanks doogie ,
anyone could help in more details in what might be the best approached to writte such script , sorry I am a novice :(
thanks in advance

11-16-2003, 11:12 PM
Normally I think of teaching (and the use of forums) as a guide for you to learn for yourself. But here's pretty much a verbatim example:

file -type "mayaAscii" -open "D:/projects/HomeProjects/scenes/New Folder/file1.ma";
// execute your script
file -save;

file -type "mayaAscii" -open "D:/projects/HomeProjects/scenes/New Folder/file2.ma";
// execute your script
file -save;

file -type "mayaAscii" -open "D:/projects/HomeProjects/scenes/New Folder/file3.ma";
// execute your script
file -save;

or a for loop would be easy for a sequence

for(int $i=0;$i > 19; $i++)
file -type "mayaAscii" -open "D:/projects/HomeProjects/scenes/New Folder/file" + $i + "1.ma";
// execute your script
file -save;

Lastly, I suggest you save with a different filename, in case your script totally screws up the scenefiles. Good luck.

11-17-2003, 02:40 PM
thanks again doogie,
anyone knows how I can tell in a script to process all the files that are in a designated folder ?

11-17-2003, 03:34 PM
To get a list of all the files in a folder you would use the getFileList command.

string $allMa[]=`getFileList -folder "C:/myFolder/" -fileSpec "*.ma"`;

// do stuff


11-17-2003, 03:38 PM
thanks GDC
but how can I have a window type like that let me browse and select any folder where I want to batch process some data into them ? I am stuck :(

11-17-2003, 06:22 PM
"fileDialog" command

11-17-2003, 08:43 PM
cheers ajk48n
I am crap aint` I :(
the thing is I am trying to learn mel script so I thought the best way to learn would be to do something that might be usefull for me. thx again you guys for your patience and taking the time to answer my questions

11-18-2003, 07:18 AM
If you're trying to find a MEL command for something you can do in the interface, open the Script Editor and turn on "Echo All Commands". This will show every command that is being executed, and then you can look in the docs to see how to use it.

Sometimes, however, you'll see something called that isn't a documented MEL command. Then it gets a little bit trickier. You can go to the scripts folder in the Maya installion directory and look through the scripts there for one that has a name that is close to the command that is run.

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