View Full Version : sourcing all scripts directly from network dir (?)

12 December 2007, 02:46 PM
hey !

to keep file handling as low as possible, i'd like to source mel scripts from outside the Userdocuments/maya/scripts/ folder.

how would i write a script that sources ALL SCRIPTS found in the directory directly from the correct folder on a network drive ?

example drive name: T:/MELSCRIPTS/

it's important that i don't want to update that script for each added script by typing:
"source script A, then B, ..."
"source all You find"

any help ? thanks !

12 December 2007, 03:42 PM

the source command like this works:
source "C:/Documets and Settings/name/.../script.mel";

but the wildcard like this does not work:
source "C:/Documets and Settings/name/.../*.mel";

let's try some more...

12 December 2007, 04:54 PM
i got the script working...

will post it later ... or tomorrow...


12 December 2007, 11:12 AM
okay there we go:

just enter the path there with "/" (forward slashs)
and put the code to a shell 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 + "\"");

CGTalk Moderation
12 December 2007, 11:12 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.