SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Running a MEL script
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 28-02-2005, 12:30 AM   #1
Protheus
Registered User
 
Protheus's Avatar
 
Join Date: Sep 2002
Location: Beyond Oblivion
Posts: 471
Thanks: 0
Thanked 5 Times in 5 Posts
Default 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 ?
__________________
The Important Thing is NOT to Stop Questioning.
--- Albert Einstein ---
www.ProtheusWorld.tk
Protheus is offline   Reply With Quote
Old 11-03-2005, 05:55 AM   #2
lori_hunter
Registered User
 
Join Date: Dec 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
lori_hunter is offline   Reply With Quote
Old 11-03-2005, 01:50 PM   #3
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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.


Alan
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 11-03-2005, 02:00 PM   #4
Protheus
Registered User
 
Protheus's Avatar
 
Join Date: Sep 2002
Location: Beyond Oblivion
Posts: 471
Thanks: 0
Thanked 5 Times in 5 Posts
Default

thanx all - I never knew that MEL scripting could be so easy. :-)
__________________
The Important Thing is NOT to Stop Questioning.
--- Albert Einstein ---
www.ProtheusWorld.tk
Protheus is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MEL headache! happymat27 Members Lounge 5 05-12-2010 08:43 AM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 03:41 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.