Creative COWSIGN 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 Tutorials

Renamer script

COW Forums : MAYA

VIEW ALL   •   ADD A NEW POST   •   PRINT
Social ShareSend Email MessageShare on FacebookShare on TwitterShare on LinkedInComment
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  
Social ShareSend Email MessageShare on FacebookShare on TwitterShare on LinkedInComment


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




LOGIN TO REPLY



FORUMSTUTORIALSFEATURESPODCASTSEVENTSSERVICESJOBSNEWSLETTERNEWSBLOGS

Creative COW LinkedIn GroupCreative COW Facebook PageCreative COW on Twitter
Social ShareSend Email MessageShare on FacebookShare on TwitterShare on LinkedInComment
© 2016 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]