Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Running a MEL script (https://simplymaya.com/forum/showthread.php?t=15610)

Protheus 28-02-2005 01:30 AM

Running a MEL script
 
Oke I am all new to this MEL scripting.

I have the following issue - I created the following script as a test run:

window -rtf true -title "Test" Testwindow;
showWindow Testwindow;

the scripped is called: test.mel

I have placed it in the: C:\Documents and Settings\username\My Documents\maya\6.0\scripts

and then I start Maya.
But when I type: test; in the command line I get the message:

Mel Stack Trace
Cannot find procedure "test".
Start of trace: (command window: line 1).
test (command window: line 1).

Oke I looked up in the forums and you should be able to call up the script by typing its windows name and press enter ??

So what am I doing wrong ?

lori_hunter 11-03-2005 06:55 AM

i think you need to load the script in the script editor first before you can execute it.

another thing is once it is executed Maya retains it in local memory. I had a problem where i had to quit Maya and reopen the scene file to refresh it if i made any changes, otherwise Maya will keep sourcing the first executed script.

hope that helps...

Lori

Alan 11-03-2005 02:50 PM

if you have a procedure in a file e.g.

global proc alanTest()
{
print("blah\n");
}

you run it with by typing alanTest. However as lori_hunter said you have to source it first. So if I wanted it to pick up my changes each time I ran it I would do this:

source "path to my script";
alanTest;

And then run them togther each time to make sure it's sourced each time. Also the thing lori_hunter said about local memory is true if you declare a variable in the script editor it will stay persistent until you close maya. A good way around this is to encapsulate it in {} brackets. That way it's declared in "scope" and wont affect the global session. Good for testing out stuff.

:ninja:
Alan

Protheus 11-03-2005 03:00 PM

thanx all - I never knew that MEL scripting could be so easy. :-)


All times are GMT. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018