FORUMS: list search recent posts

Renamer script

COW Forums : Autodesk Maya

Respond to this post   •   Return to posts index   •   Read entire thread

Otto Lindqvist
Renamer script
on Jul 11, 2012 at 8:23:28 am


I started to study MEL to make my future life easier with scripting. I've studied C++ and C# in school and the logic is similar. Languages of course has their differences.

I got the basic script working, but I wanted to create window where to give the commands so no need to edit the code every time with new name.

This is the basic code which works just fine (I had the variables in finnish and changed those in english just in fly. Should work however)

//Valitse objektien nimi ja muista lainausmerkit!

string $NewName = "Jalusta_risti";

//--------Älä Koske!---------------------------------------

string $Named [] = `ls -sl`;

for ($myNode in $Named)
select $myNode;
rename $NewName;

Here is the code which should create a window where to type to textfield and no need to touch the code. However I get few errors and few are confusing me because before the window system those worked just fine. Here's the error messages:
// Error: string $Named[] = `ls -sl`; //
// Error: Syntax error //
// Error: for ($myNode in $Named) //
// Error: "$Named" is an undeclared variable. //
// Error: select $myNode; //
// Error: "$myNode" is an undeclared variable. //

window -title "Rename objects" -rtf true RenamerWindow;

textField -label "New name" -field true "NewName";

button -label "Rename" -c "Renamer";

showWindow RenamerWindow;

proc Renamer ()

string $NewName = `textField -q -value "NewName"`
string $Named [] = `ls -sl`;

for ($myNode in $Named)
select $myNode;
rename $NewName;


Anyone who could help me? Thanks!

Btw, does anyone know any good script editor for mac which understands MEL?

Posts IndexRead Thread 

Current Message Thread:
  • Renamer script by Otto Lindqvist on Jul 11, 2012 at 8:23:28 am

© 2018 All Rights Reserved