AdamMax
11-15-2010, 04:02 AM
Hi guys,
I'm trying to launch maya from the command line (via python) and have it run a procedure that I've put in userSetup.mel. The procedure is given the location of a txt file "mayafileList" so that it can do stuff with the contents of the text file.
So firstly.
I've put "userSetup.mel" in
C:\Documents and Settings\Me\My Documents\maya\2011\scripts\userSetup.mel
Is this the correct location for getting a mel script to run on startup? It appears to be running it because I'm getting syntax errors on my code (below).
This is the code for userSetup.mel
proc Batch_Export (mayafileList, overw){ $f = 'fopen mayafileList "r"';
while (!'feof $f'){
string $source_url = 'fgetline $f';
string $dest_url = 'fgetline $f';
file -o $source_url;
file -force -options "" -type "FileType" -pr -ea $dest_url' -prompt;
}
fclose $f;
}
I'm getting syntax errors for my procedure. Not the most helpful error either (no line number or description).
And the command line executed from a python script using os.system() so that I can pass it arguments is;
maya -command 'Batch_Export(mayafileList, overw);' -prompt
Any help would be appreciated,
I cant seem to fix the errors I get on Maya load
// Error: proc Batch_Export (mayafileList, overw){ //
// Error: Syntax error //
// Error: proc Batch_Export (mayafileList, overw){
//
// Error: Syntax error //
// Error: $f = 'fopen mayafileList "r"';
//
// Error: Syntax error //
// Error: while (!'feof $f'){
//
// Error: Syntax error //
// Error: string $dest_url = 'fgetline $f';
//
// Error: Syntax error //
etc
I'm trying to launch maya from the command line (via python) and have it run a procedure that I've put in userSetup.mel. The procedure is given the location of a txt file "mayafileList" so that it can do stuff with the contents of the text file.
So firstly.
I've put "userSetup.mel" in
C:\Documents and Settings\Me\My Documents\maya\2011\scripts\userSetup.mel
Is this the correct location for getting a mel script to run on startup? It appears to be running it because I'm getting syntax errors on my code (below).
This is the code for userSetup.mel
proc Batch_Export (mayafileList, overw){ $f = 'fopen mayafileList "r"';
while (!'feof $f'){
string $source_url = 'fgetline $f';
string $dest_url = 'fgetline $f';
file -o $source_url;
file -force -options "" -type "FileType" -pr -ea $dest_url' -prompt;
}
fclose $f;
}
I'm getting syntax errors for my procedure. Not the most helpful error either (no line number or description).
And the command line executed from a python script using os.system() so that I can pass it arguments is;
maya -command 'Batch_Export(mayafileList, overw);' -prompt
Any help would be appreciated,
I cant seem to fix the errors I get on Maya load
// Error: proc Batch_Export (mayafileList, overw){ //
// Error: Syntax error //
// Error: proc Batch_Export (mayafileList, overw){
//
// Error: Syntax error //
// Error: $f = 'fopen mayafileList "r"';
//
// Error: Syntax error //
// Error: while (!'feof $f'){
//
// Error: Syntax error //
// Error: string $dest_url = 'fgetline $f';
//
// Error: Syntax error //
etc
