MEL Script Problem

MEL Script Problem

Anonymous
Not applicable
1,125 Views
2 Replies
Message 1 of 3

MEL Script Problem

Anonymous
Not applicable

Hi guys,

 

I'm writing a MEL script here and some of my script's contents are not turning the colour they should be in order to work. For example:

 

///Renamer Tool
//Create a window and make it adjustable
string $RNM_Wind = `window -t "Rename It!"`;

columnLayout -adj 1;
//Query Selection
string $sel[] = `ls -sl`;

 

//ForLoop - “for every object selected in ($sel), run the following commands”
for ($each in $sel){
//Create name fields that let us find and edit each object’s name
nameField -o $each;
}
//Button
button -l “CLOSE" -c “deleteUI - window $RNM_Wind”;
//Show the window
showWindow $RNM_Wind;

 

Now, where it says $sel, $each and at the end $RNM_Wind; should be light blue in italics, but they aren't and I've tried rewriting them several times and double checking the script that I transcribed and everything to me looks good. So why does this happen? How can I fix it? Has the MEL language changed in anyway from previous years?

 

Thanks for the help.

 

M

0 Likes
Accepted solutions (1)
1,126 Views
2 Replies
Replies (2)
Message 2 of 3

saihtam
Collaborator
Collaborator
Accepted solution

As far as I can remember and see right now, variables don't get a color change. Only procs. Does your code work? Because it didn't for me when I first ran it. You have some wrong quotation marks going on for the 'CLOSE' button line.

 

This works for me:

 

///Renamer Tool
//Create a window and make it adjustable
string $RNM_Wind = `window -t "Rename It!"`;
columnLayout -adj 1;
//Query Selection
string $sel[] = `ls -sl`;
 
//ForLoop - “for every object selected in ($sel), run the following commands”
for ($each in $sel){
//Create name fields that let us find and edit each object’s name
nameField -o $each;
}
//Button
button -l "CLOSE" -c "deleteUI - window $RNM_Wind";
//Show the window
showWindow $RNM_Wind;
- Mathias
Message 3 of 3

Anonymous
Not applicable
Hi, Thanks for the reply. Funny enough, I ran the script and it ended up failing the first time, but somehow, Maya corrected the code I was having trouble with and then ran it again and it worked.

Thanks for the solution.
0 Likes