MEL scripts


I’ve put this one together for running scripts on multiple scenes. I probably wont release it on CreativeCrash, mainly because its only real use if for people who write their own scripts anyway. It’s designed to sequentially load scene files, run a selected script, and resave the scenes before moving on. It’s pretty straightforward, but a quick guide:

installation: RH_MultiScene.mel in you scripts dir. A subdir should be created in scripts too, called RHMS_Custom (more on that later). some sample scripts included.

  1. change the current scenes folder

  2. check/uncheck all scenes

  3. scenes list… the almost invisible button at the end just loads that scene instantly.

  4. checkbox to toggle scenes to process, (indicator light to the left to show successful completion).

  5. Custom Scripts… This is where the real meat is - it looks for scripts in a subfolder of Scripts called RHMS_Custom. Basically, if you need to make a small script and run it on a series of scenes, just drop your script in this folder and run RH_MultiScene :slight_smile: (obviously no interaction possible during the batch running.) It’ll find, source and run your selected script on multiple scenes.

Also works unexpectedly like a library for all the small silly 3-line scripts one might write :slight_smile:

The zip can be found here
Oh yes, - and meant for Maya2011, not tested on previous versions.


he Reeks! looking neat :]

we have something like that as well:

Once set up by the programmers here… but soon I changed almost everything under the hood. The thing I’m most proud of and which made it finally usable for a not-so-geeky-artist is the list. Its updated on change of the pattern fields. So you immediately see what its working on. You can even just delete items from there. Before you just had to give it some names and cross fingers…
Behind the “…” is a function to create scripts as well. Nice functionality here: I introduced several variables that you can use in the fired script:

[li]save_scene (if you decide in the script the file shall be saved set this true. the tool will handle version control write enable and stuff)[/li][li]first_loop (is true only in the first loop of course. this way you can ask for certain parameters that you might be looking for)[/li][li]break_loop (if true it savely hops out of the process and still displays gathered stats)[/li][/ul]
nothing to release as well… its part of our toolchain. So biggups for releasing yours! :smiley:

Say did you use Qt stuff? Or is this just simple mel-ELF-UI?


Thank you ewybody :slight_smile:
Yes, I was really surprised to see there was nothing to do the job on CreativeCrash, and it’s a remarkably useful concept - especially with the workflow we employ at the moment. Mutliple scene files are great, right up until a client wants changes ;p

Your “first_loop” sounds like a great idea. It’s one of the things I would have like to put into mine (the ability to pause on an input requester output) but time was short and I’m still very new to mel programming. Frankly, it stumped me, so any advice there would be most welcome!

No QT at this point, just manual mel typing. I had a look at QT a few weeks back (all excited I was, too!) but felt like using ED209 to catch a mouse at that point ;D. I actually find UI design a little bit fun, (I know, first sign I’m not a programmer) so I don’t mind manual entry.

again, thanks for the feedback, and hopefully it’s of use to someone else too.


Hi everyone.

I finally finish this script very useful where I work. Basically, this script allows you to create a reference using a file which is a version higher than the one we are using. Tested on Maya 2010 and 2009.

On last thing. Its very important that in Open Scene click on the little box and check the option that says --> Ignore Version.
Attached Files (1.5 KB, 0 views)

I can find here script


I just found this thread. I would like to share a script as well but I need help figuring out how to have it run at startup in Maya 2011 before it is complete. I made a custom drop drown menu to reduce screen clutter(check attachment) and I have all the commands working fine, just need to know how to have it run at startup. I’ve been searching online and there seem to be some reference to usersetup.mel. But I dont have that file ?


Hey Tareq, the userSetup.mel file doesn’t exist by default as there are no user commands to run by default! You have to create it yourself (put it in your \my docs\maya\scripts\ folder if it’s valid for all versions of Maya, or inside \my docs\maya\2011\scripts\ if it is version specific).

You don’t really have to make your menu auto-run at startup, and most users will already have a userSetup.mel, so you should be ok just tellling people what command to add to the userSetup in your install instructions. Much easier than trying to write code to insert the command in their userSetup.mel!

is your new menu just a bunch of short-cuts to existing Maya options? couldn’t you have just dumped all that stuff on a Marking Menu…?



Hey Nathan

My new menu is indeed a dump of normal maya commands. I was using the shelf all this time but grew tired of the icons, I prefer text menus. Also the toolbox on the left didn’t serve any purpose except when I double-click to enter tool settings. So I combined the shelf and toolbox into one handy drop down that I can have open always. I tried Marking menu but personally I feel one click access beats click+hold+click.

I hid the shelf so I cannot run my script from it anymore so I prefer maya loading it automatically at startup. As for usersetup, what are the contents of this file ? Can I just rename my script to usersetup.mel ?


good grief, no I wouldn’t do that. Ideally your menu code should be in a global proc (let’s assume it’s called “tsyraMenu” and it’s saved into into a script (text) file called “tsyraMenu.mel” in your my docs\maya\scripts (or version equivalent).
In your userSetup you just need to add a call to it, essentially just the line:


you could encapsulate the call inside a catch just to be extra safe (especially if you add more stuff to the userSetup later!). If you don’t have a userSetup.mel file simply create one.



Ok thanks, I think I got it. Yea it is saved currently on the desktop. I’m gonna mess with this see what I get thanks.


on the desktop
oh my!! you are quite a beginner aren’t you? :smiley: I mean no offence! We all started somewhere… And sometimes people that don’t have their heads already stuffed so deep into it bring up some fresh ideas.

But your habbit of working rather with that kind of floating menu instead of Hotkeys and context sensitieve Marking menus is a little strange…
You say “one click access beats click+hold+click” ?!?

Its actually:

  • point your mouse to somewhere else where you aren’t working (to a window thats blocking part of your viewport)
  • look for an entry
  • click it
  • go back to the spot where you worked
  • hotkey (in case of move-, rotate-, scale-tool which are on W E & R, or duplicate!)
  • shift+RMB+leftstroke (if you want split polygon tool and have polys selected)

same for extrude (shift+RMB+downstroke), Select Edge Loop (doubleclick or ctrl+RMB+downrightstroke) Create Polygon Tool (nothing selected+shift+RMB+upstroke) Create Primitive (nothing selected+shift+RMB+MarkingMenu) Sculpt Geometry Tool (shift+RMB+upleftstroke)

I mean: sure you do your stuff for customizing! I really appreciate and always encourage that! But for me: MarkingMenus are a blessing! I learned a LOT about usablitiy design from that. The MMs in Maya are not perfect, there could be more colors or icons on the MMs or they could all be customizable easily (which they aren’t, you (just) need to script of course).
Sometimes I wish there’d be markingMenus all around in the system! :smiley:


The script editor was saving the script to a temp folder and as soon as I would close maya the mel file gets deleted. Thats why I saved it to the desktop. Once I figure out which folder it goes to I will move it there.

I use a tablet and I like one click. I have lost many many hours right click and holding and then choosing vertex and then right click and hold and choosing object mode. The only time I ever use the hotbox is to use the delete edge loop command. I don’t see the point in going about it that way either because now I can double click on an edge to get the loop and just click on delete edge/vertex and I’m done. I try to simplify something for argument sake and you made me a bullet form list which I will use now to show you something:

  1. Point your mouse to where you are not working - I can just click on the action I want to perform in my menu
  2. Look for an entry - all my entries are ready in the drop down and probably already executed in step 1
  3. Click it - Already done in step 1
  4. Go back to the spot where you worked - Why ? I’m already 2-3 steps ahead because I avoided steps 2, 3 and 4 by now
  5. shift+RMB+leftstroke, shift+RMB+downstroke - DIRECT one click access in my menu. All your shortcuts involve 2 keys and a mouse stroke :s

Since you took the time to show why you love it I am making an effort now to show you why I think you are wrong. You can enjoy your tried and trusted workflow and I would like to keep mine.

I need help with the startup mel file since I don’t have one I don’t even know what goes on in there. Nathan gave some feedback earlier but the fact still remains that I don’t know what the contents of the file are. If you can help me with that, it would be awesome.

I have been working with the drop-down for a bit now, I added vertex/edge/face select modes on it as another tear off menu, undocked attribute editor, tool settings and channel box for full screen bliss :). I decided not to mess with the startup, I just opened a tab in script editor where the script is pasted, when I startup I just go there and run it. Seems to work well for me. :thumbsup:


Like I said. No offense. You work like you do it. I’m just saying people took already a little care about stuff like that. Anyhow: Didn’t know you wirking with a tablet. Sure: I know button-stroke combinations are teh crrp with that.

But thats actually another interface design flaw… because from that point of view MMs beat everything that exist:

[li]only visible when needed[/li][li]work at the spot where you are (mousemove takes time)[/li][li]show only stuff that is currently possible (no bloat/distractions)[/li][li]good for beginners: just hold and see whats there[/li][li]good for pros: just stroke[/li][/ul]so for that userSetup.mel: there is a command to find the spot where you need to put it:

internalVar -userScriptDir;

Thats yields the place for all your scripts you want to have at startup.
So if you have a .mel-file in there thats named tsyraSupertool.mel and there is a global proc inside with the name tsyraSupertool you can just start up Maya and hit a button that calls tsyraSupertool; OR: You can have it in the userSetup.mel: Just one line that says


If you have it somewhere else you could also source your script from the userSetup.mel by calling:

source "c:/anylocation/tsyraSupertool.mel";


Thanks ewerybody. I will get on it.

Don’t get me wrong, I always end up using marking menu’s for creating cameras and lights, and some other stuff. But with my tablet pen its getting painful with the click and hold stuff. I used the shelf for a long time but I like the menu better.


Have you tried setting the buttons on the pen? You can have one set to be a right-click and the other to a middle-mouse click.

I currently have my pen set to have one of the buttons be a right-mouse click and the other set to an alt modifier (this is mainly because the alt is so useful for navigating and as a color picker in PS). I put the middle-mouse click on the eraser so when I need a middle mouse click I just flip the pen over like an eraser and hold the alt or other modifier buttons if I have to and it works really well.

Another option that a friend uses quite effectively is to have one of the pen buttons be a space-bar and he works with everything turned off in the gui and gets to all his menus that way.

Just a thought :slight_smile:


Yea no problem. But… you know its not, that I “hold” if I know what I’m doing: If you are into it, its more like gestures. You don’t have to wait for the MM to build up. Its a combination of sweep-directions with a combination of modifyers…

but yes: less modifyers > more convenient. When working on a laptop without mouse its pain as well. I’d love to get rid of one or the other mousebuttonclick.

but for instance the TimeDragger-Hotkey does different stuff with different buttons: K+LMB=TimeDragger, K+MMB=TimeDraggerWithoutValueChange

a good example of modifyer reduction:
Photoshop has the Space+LMB-panning (which is like Alt+MMB in Maya). Now Gimp came along and put this on “Space” only! Besides from 1000s of other crappy things in Gimp. THIS for example feels just too good!


Well you see, I got a bamboo fun medium. So everything is fine but the pen is not “fun” to use in long runs. As opposed to the intuous 3’s and 4’s pen. My pen tip is left click, then theres 2 buttons one is middle and the other is right click. I guess its the way I hold it because it hurts I find it hard to use the buttons on the side. So that is why I am trying this way…with the drop down. I haven’t worked with the new setup yet, but I think its going to work out very nice hehehh.

I have a dual monitor setup so I am thinking about maybe using qt to design a 2nd window to be open full screen on the 2nd monitor to have tool settings, attribute editor and maybe some other stuff. Who knows, all in due time :slight_smile:


Well thats obviously a hardware problem :smiley:
you could use Autohotkey to map certain key as mouseButtons if it doesn’t feel good to press the keys on the pen…


hey! i’m new in mel scripting. I want to change the size of an already existing model. i’m takin input from user. How is it possible to load some model created in maya? and then change the size life radius or height of it? i have the idea as to how can i change the size but the core problem here is how can i load the model??


Hey everyone!

I’m new in mel scripting. I want to load an existing model and change its particular parts, like im taking input from user and changing the model’s dimensions accordingly… any help as to how can i load the model then change it? as far as i’ve learned so far model can b created at runtime then changed , but i still am unaware to how can i change or resize an existing one?
plz help…
:slight_smile: :slight_smile:


i found this forum very lively, thats why i made post here, can anyone help me? why i’m not getting any reply? :cry: i’m new in maya… i have my FYP in 3D modeling…
The core idea is that i have to create human models dynamically, on user input, like user when tells his/her body measurements, then i have to show him his very own dummy. i browsed internet and found out mel to b a solution (in my opinion) and now i did some practice …but got stuck at one place, i’m making 3 cylinders in mel (just to see if the tech works) then took input from user in webpage and called a function test, that resides in a separate mel file, but in this function there is a line that throws error when it gets launched in maya. here are all my files.

1) test.htm 

<TITLE>Make your own dummy...</TITLE>

<object width="550" height="400">
<param name="movie" value="MTB.swf">
<embed src="MTB.swf" width="550" height="400">

<SCRIPT language="JavaScript">
function js_test()
var top;
var mid =document.test_form.mid.value;
var bottom =document.test_form.bottom.value;
var mel_url = "mel://test("+top + ", " +mid + ", " +bottom + ")/";
location = mel_url;
<a href="">
go to
<FORM name="test_form" onSubmit="js_test(); return false;">
<B>enter your figure: </B>
<INPUT type="text" name="top" size="30"><P>
<b>Mid </b>
<INPUT type="text" name="mid" size="30"><P>
<b>Bottom </b>
<INPUT type="text" name="bottom" size="30"><P>
<INPUT type="submit" value="test">


proc string get_path_url_test() 
string $path_to_proc="whatIs make_web_test";
string $path_parts[];
string $lead_in = "Mel procedure found in:";
string $path_url = "file:/";
int $i;
$path_url = $path_url + substring($path_to_proc,(size($lead_in) + 1),size($path_to_proc));
tokenize $path_url "/" $path_parts;
$path_url = "";
for ($i = 0; $i < (size($path_parts) -1); $i++) 
$path_url = $path_url + $path_parts[$i] + "/";
return $path_url;
global proc make_web_test() 
string $myurl = (get_path_url_test() + "test.htm");
print ($myurl + "
string $myWindow ="window -widthHeight 800 600";
webBrowser -url $myurl;
showWindow $myWindow;


proc string get_path_url_test() 
string $path_to_proc = "whatIs make_js_web_test";
string $path_parts[];
string $lead_in = "Mel procedure found in: ";
string $path_url = "file:/";
int $i;
$path_url = $path_url + substring($path_to_proc,(size($lead_in) + 1),size($path_to_proc));
tokenize $path_url "/" $path_parts;
$path_url = "";
for ($i=0; $i<(size($path_parts)- 1); $i++) 
$path_url=$path_url+ $path_parts[$i]+ "/";
return $path_url;
global proc test(float $top, float $mid, float $bottom) 

//ive tried many scripts to make cylinders, but anything i try, it //throws error down here at these lines	
polyCylinder -axis 0 5.034248 0 -height 3 -name "pCylinder1" -radius 2.0 -sx 12 -sy 1 -sz 1;
	polyCylinder -axis 0 5.034248 0 -height 3 -name "pCylinder2" -radius 2.0 -sx 12 -sy 1 -sz 1;
	polyCylinder -axis 0 5.034248 0 -height 3 -name "pCylinder3" -radius 2.0 -sx 12 -sy 1 -sz 1;

select -r pCylinder1 ;
scale -r $bottom 2.068992 $bottom ;
select -r pCylinder2 ;
scale -r $mid 2.068992 $mid;
select -r pCylinder3 ;
scale -r $top 2.068992 $top;

global proc browserBack()
global string $myWebBrowser;
webBrowser -e -back $myWebBrowser;
global proc browserForward() 
global string $myWebBrowser;
webBrowser -e -forward $myWebBrowser;
global proc browserHome() 
global string $myWebBrowser;
webBrowser -e -home $myWebBrowser;
global proc make_js_web_test() 
global string $myWebBrowser;
string $myurl = (get_path_url() + "test.htm");
print ($myurl + "
window -width 800 -height 632 -title "Make some spheres";
rowLayout -numberOfColumns 3 -columnWidth3 32 32 32 -columnAlign 1 "right" -columnAttach 1 "both" 0 -columnAttach 2 "both" 0 -columnAttach 3 "both" 0;
iconTextButton -c "browserBack()" -image "back.JPG";
iconTextButton -c "browserForward()" -image "forward.JPG";
iconTextButton -c "browserHome()" -image "homepage.JPG";
setParent ..;
$myWebBrowser = "webBrowser -url $myurl";

ive tried many things, but i guess my approach aint right… thats why i get stupid errors, any function that i make, that has to change the position of cylinders along with creating them, it dznt create the cylinders… i totally have no idea whats wrong…