PDA

View Full Version : Source command question


Irakli
07-31-2012, 03:33 PM
Hay guys,
I'm trying to source a mel file from subfolder of scripts directory but without success.
e.g.
I have a folder called "myCustomScripts", which is top level folder and I already added it to the Maya.env file. In that directory there is another folder called "Modeling". Now I'm trying to source the script from "Modeling: folder.
source ("Modeling"+"\\"+"script.mel");
orsource ("Modeling"+"/"+"script.mel");
and I get syntax error. Can't figure out what I'm doing wrong.

TDgirl
07-31-2012, 04:16 PM
As long you add the path of where your script is in Maya.env in the MAYA_SCRIPT_PATH environment variable, then you should be able to source your script like this:

source script.mel;

or

source "script.mel";

Don't need parenthesis-- I think that's why you get the syntax error.

Hope this helps!!

fezz
07-31-2012, 04:20 PM
eval(" source \"Modeling"+"/"+"script.mel\";");


Just remember to escape strings when you run commands this way, else mel won't understand what you're giving it.

Irakli
07-31-2012, 05:01 PM
TDgirl
Thank you.
This directory is not added in the MAYA_SCRIPT_PATH variable.

fezz

Thank you! Now it works!

Irakli
07-31-2012, 05:22 PM
Actually I'm building menu and the command will looks like this :
menuItem -l "Tool Name" -c ("eval(\"source\\\"Modeling\"+\"/\"+\"script.mel\\\";procedureName();\")") ;

CGTalk Moderation
07-31-2012, 05:22 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.