View Full Version : how can I use source command with a variable?

07 July 2012, 04:10 PM
Looks like I can't use the source command if the path is declared as variable in maya.env or usersetup.mel or anywhere in the system registry.

So, how can I do it?

I tried to put it in eval command, still not working at all. Any explanations on the internet in the end used the path, even inside the eval command, but I need something like
source $rootPath + "whatever.mel"
to work

Thank you.

07 July 2012, 04:33 PM
Check that, should help..

Other than that, learn Python ;)

07 July 2012, 04:38 PM
eval is the way. if it didn't work you probably made a minor error in the catenation or escaping or missed the quotes or something...
string $path = "c:/work/folder/";
eval("source \""+$path+"someFile.mel\"");

07 July 2012, 04:49 PM
Thank you gusy for the fast replies.
I will try again with the eval command, I did have the strong feeling I am doing it wrong :shrug:

CGTalk Moderation
07 July 2012, 04:49 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.