Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
MAYA:MAYA ForumMAYA TutorialsMAYA

Renamer script

COW Forums : MAYA

VIEW ALL   •   ADD A NEW POST   •   PRINT
Share on Facebook
Respond to this post   •   Return to posts index   •   Read entire thread


Otto LindqvistRenamer script
by on Jul 11, 2012 at 8:23:28 am

Hello,

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;
columnLayout;

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
Reply   Like  
Share on Facebook


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




LOGIN TO REPLY



FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]