Page 1 of 1

MEL-Script for sourcing external scripts

Posted: Fri Dec 21, 2007 1:17 pm
by deadalvs
hi ...

i was tired of putting duplicates of my scripts in maya's default scripts folder, so i wrote a little script that lets me source the scripts from any directory.
like this i can store all my scripts on a shared network folder and keep the maya installations clear.

the script actually checks the dir for all .mel scripts and sources ALL that is found.
simply put the code to a shelf button or in the userSetup.mel file.

string $path = "enter path here";

string $FileArray[] = `getFileList -folder $path`;
for ($eachFile in $FileArray){
//print ($eachFile + "\n");
string $buffer[];
$numTokens = `tokenize $eachFile "." $buffer`;
if ($buffer[(size($buffer))-1] == "mel"){
string $FullPath = $path + $buffer[0] + ".mel";
eval ("source " + "\"" + $FullPath + "\"");
}
}
i hope someone can use this too...