PDA

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


Leionaaad
07-03-2012, 05:10 PM
Hi.
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.

sonicstrawbery
07-03-2012, 05:33 PM
Check that, should help..

http://www.scriptswell.net/2010/02/mel-source-script-with-variable.html

Other than that, learn Python ;)

NaughtyNathan
07-03-2012, 05: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\"");

Leionaaad
07-03-2012, 05: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-03-2012, 05: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.