MEL scripts


Your random compliments script is a hilarious idea brent. At lunch had a spare few minutes and modified it so now before every batch render it compliments me and wishes me good luck hahah


Thanks Hamburger, here’s the updated version. Now that I’m delving into python I’m thinking about ways to have the compliment generator query a webservice instead of a local file

//replace the $filePath string with your own custom compliments.
//have the first line of your compliments.txt be Titles, like "Mr, Captain, Buddy.." etc

global proc buildWindow(string $texties, int $randy){
	$windowName = ("Motivational #"+$randy);
    $response = `confirmDialog -title $windowName -bgc 0.9 0.8 0.1 -message $texties 
    -button "OK"
    -button "Motivate me again" -defaultButton "OK"
    -cancelButton "OK"
    -dismissString "OK"`;
    if ( $response == "Motivate me again" ){
global proc complimentMe ()
    string $title[], $comps[], $token[], $user, $localUser, $filePath, $os;
    int $randy; 
    $os = `about -os`; 
    string $filePath = "/salu/home/wherever/compliments.txt" ;
    if ($os == "linux64") {
            $user = `getenv USERNAME`; 
            $user = `getenv userName`; 
    $localUser = `capitalizeString $user` ; 
    $fileId = `fopen $filePath "r"` ; 
    string $nextLine = `fgetline $fileId` ;   
    while (size($nextLine) > 0) {  
        string $cleanLine = strip($nextLine) ;    
        $comps[size($comps)] = $cleanLine ;  
        $nextLine = `fgetline $fileId` ;   
    int $randy = rand(1,(size($comps)));
    $title = stringToStringArray ($comps[0], " ");
    int $randTit = rand (size($title));
    string $texties = ($title[$randTit]+" "+$localUser+", "+$comps[$randy]);
    buildWindow($texties, $randy);
    fclose $fileId;


Here is a sample Compliments.txt to save

Mr. Handsome Lord Captain Master Maestro Honorable Hey Mister General King Commander Dudeman Good Yo
if you're ever feeling down, if you ever feel unappreciated, stop and realise that this random number generator chose this heartfelt message to deliver right to you.
you stallion!
you champion!
you superstar!
you genius!
don't you think you've had enough compliments for one day?
you may think that I say all these nice things about everybody, but I really only say them about you!
the successful warrior is the average man, with laser-like focus
you wonderful person
you handsome man
you can do anything, but not everything.
you killer
you maniac
you're good enough, you're smart enough, and god dammit, people like you!
enjoy this picture of a fish: <"{{{><
the reason most people never reach their goals is that they don't define them, or ever seriously consider them as believable or achievable. Winners can tell you where they are going, what they plan to do along the way, and who will be sharing the adventure with them.
you monster
you prince
the distance between insanity and genius is measured only by success.
you talented mofo
you awesome guy 
you can't connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something--your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life.
you nice guy
a martial arts student approached his teacher with a question. "I'd like to improve my knowledge of the martial arts. In addition to learning from you, I'd like to study with another teacher in order to learn another style. What do you think of this idea?" "The hunter who chases two rabbits," answered the master, "catches neither one."
you cool dude
a doctor reaches into his smock to get a pen to write a prescription and pulls out a rectal thermometer. "Oh, damn it," he proclaims, "Some asshole has my pen!"
time for a coffee break. |_P
I'd like to teach the world to sing in perfect harmony.  La la la! Isn't that nice?
you amazing specimen
Take up one idea. Make that one idea your life--think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success.
two factory workers are talking. The woman says, "I can make the boss give me the day off." The man replies, "And how would you do that?" The woman says, "Just wait and see." She then hangs upside down from the ceiling. The boss comes in and says, "What are you doing?" The woman replies, "I'm a light bulb." The boss then says, "You've been working so much that you've gone crazy. I think you need to take the day off." The man starts to follow her and the boss says, "Where are you going?" The man says, "I'm going home, too. I can't work in the dark."
you champ!
a new student approached the Zen master and asked how he should prepare himself for his training. "Think of me a bell," the master explained. "Give me a soft tap, and you will get a tiny ping. Strike hard, and you'll receive a loud, resounding peal.
you're incredible
a lawyer runs a stop sign and gets pulled over by a sheriff. He thinks he's smarter being a big shot lawyer from New York and has a better education than an sheriff from West Virginia. The sheriff asks for license and registration. The lawyer asks, "What for?" The sheriff responds, "You didn't come to a complete stop at the stop sign." The lawyer says, "I slowed down and no one was coming." "You still didn't come to a complete stop. License and registration please," say the sheriff impatiently. The lawyer says, "If you can show me the legal difference between slow down and stop, I'll give you my license and registration and you can give me the ticket. If not, you let me go and don't give me the ticket." The sheriff says, "That sounds fair, please exit your vehicle." The lawyer steps out and the sheriff takes out his nightstick and starts beating the lawyer with it. The sheriff says, "Do you want me to stop or just slow down?"
you're amazing
people who succeed have momentum. The more they succeed, the more they want to succeed, and the more they find a way to succeed. Similarly, when someone is failing, the tendency is to get on a downward spiral that can even become a self-fulfilling prophecy.
you're the best
you've got a nice face!
Q: How do fish get high? A: Seaweed.
Q: What is the tallest building in the entire world? A: The library, because it has so many stories.
you did it
a teacher is teaching a class and she sees that Johnny isn't paying attention, so she asks him, "If there are three ducks sitting on a fence, and you shoot one, how many are left?" Johnny says, "None." The teacher asks, "Why?" Johnny says, "Because the shot scared them all off." The teacher says, "No, two, but I like how you're thinking." Johnny asks the teacher, "If you see three women walking out of an ice cream parlor, one is licking her ice cream, one is sucking her ice cream, and one is biting her ice cream, which one is married?" The teacher says, "The one sucking her ice cream." Johnny says, "No, the one with the wedding ring, but I like how you're thinking!"
don't work too hard
a martial arts student went to his teacher and said earnestly, "I am devoted to studying your martial system. How long will it take me to master it." The teacher's reply was casual, "Ten years." Impatiently, the student answered, "But I want to master it faster than that. I will work very hard. I will practice everyday, ten or more hours a day if I have to. How long will it take then?" The teacher thought for a moment, "20 years."
twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.
you must expect great things of yourself before you can do them.
you've done well
a young woman was taking golf lessons and had just started playing her first round of golf when she suffered a bee sting. Her pain was so intense that she decided to return to the clubhouse for medical assistance. The golf pro saw her heading back and said, "You are back early, what's wrong?" " was stung by a bee!" she said. "Where?" he asked. "Between the first and second hole." she replied. He nodded and said, "Your stance is far too wide."
you're quite good looking
a master of the tea ceremony in old Japan once accidentally slighted a soldier. He quickly apologized, but the rather impetuous soldier demanded that the matter be settled in a sword duel. The tea master, who had no experience with swords, asked the advice of a fellow Zen master who did possess such skill. As he was served by his friend, the Zen swordsman could not help but notice how the tea master performed his art with perfect concentration and tranquility. "Tomorrow," the Zen swordsman said, "when you duel the soldier, hold your weapon above your head, as if ready to strike, and face him with the same concentration and tranquility with which you perform the tea ceremony." The next day, at the appointed time and place for the duel, the tea master followed this advice. The soldier, readying himself to strike, stared for a long time into the fully attentive but calm face of the tea master. Finally, the soldier lowered his sword, apologized for his arrogance, and left without a blow being struck. 
Reaching the end of a job interview, the Human Resources Officer asks a young engineer fresh out of the Massachusetts Institute of Technology, "And what starting salary are you looking for?" The engineer replies, "In the region of $125,000 a year, depending on the benefits package." The interviewer inquires, "Well, what would you say to a package of five weeks vacation, 14 paid holidays, full medical and dental, company matching retirement fund to 50% of salary, and a company car leased every two years, say, a red Corvette?" The engineer sits up straight and says, "Wow! Are you kidding?" The interviewer replies, "Yeah, but you started it."
you've done it
a journey of a thousand miles begins with something something something... I dont know.
there's no stopping you
a husband and wife are trying to set up a new password for their computer. The husband puts, "Mypenis," and the wife falls on the ground laughing because on the screen it says, "Error. Not long enough."
you've got charisma
The son of a master thief asked his father to teach him the secrets of the trade. The old thief agreed and that night took his son to burglarize a large house. While the family was asleep, he silently led his young apprentice into a room that contained a clothes closet. The father told his son to go into the closet to pick out some clothes. When he did, his father quickly shut the door and locked him in. Then he went back outside, knocked loudly on the front door, thereby waking the family, and quickly slipped away before anyone saw him. Hours later, his son returned home, bedraggled and exhausted. "Father," he cried angrily, "Why did you lock me in that closet? If I hadn't been made desperate by my fear of getting caught, I never would have escaped. It took all my ingenuity to get out!" The old thief smiled. "Son, you have had your first lesson in the art of burglary."
two traveling monks reached a river where they met a young woman. Wary of the current, she asked if they could carry her across. One of the monks hesitated, but the other quickly picked her up onto his shoulders, transported her across the water, and put her down on the other bank. She thanked him and departed.  As the monks continued on their way, the one was brooding and preoccupied. Unable to hold his silence, he spoke out. "Brother, our spiritual training teaches us to avoid any contact with women, but you picked that one up on your shoulders and carried her!"  "Brother," the second monk replied, "I set her down on the other side, while you are still carrying her."
Three elderly men are taking a walk outside their nursing home. The first one says, "Windy, isn't it?" The second one says, "No, it's Thursday!" The third one says, "So am I. Let's go get a beer."
you rule
Teacher: "Kids,what does the chicken give you?" Student: "Meat!" Teacher: "Very good! Now what does the pig give you?" Student: "Bacon!" Teacher: "Great! And what does the fat cow give you?" Student: "Homework!"
be yourself; everyone else is already taken.
you're going places!
as a group of soldiers stood in formation at an Army Base, the Drill Sergeant said, "All right! All you idiots fall out." As the rest of the squad wandered away, one soldier remained at attention. The Drill Instructor walked over until he was eye to eye with him, and then raised a single eyebrow. The soldier smiled and said, "Sure was a lot of 'em, huh, sir?"
you've done so well and in such a short amount of time
have I ever told you how much I appreciate you?
you're very good looking!
I'm about three years into my relationship now and I've started to have erection difficulties. My girlfriend and I have different ideas as to what the problem is: she bought me some Viagra and I bought her a treadmill.
Q: How do astronomers organize a party? A: They planet.
you smell teriffic
here's a joke: Molecule 1: I just lost an electron. Molecule 2: Are you sure? Molecule 1: I'm positive.
I don't say this to just anyone but you've got mad skills brother!
a scientist and a philosopher are being chased by a hungry lion. The scientist makes some quick calculations and says, "It's no good trying to outrun it. It's catching up!" The philosopher keeps a little ahead and replies, "I'm not trying to outrun the lion, I'm trying to outrun you!"
I like you!
I like you just the way you are!
I just want you to know how much I appreciate you.
A monk set off on a long pilgrimage to find the Buddha. He devoted many years to his search until he finally reached the land where the Buddha was said to live. While crossing the river to this country, the monk looked around as the boatman rowed. He noticed something floating towards them. As it got closer, he realized that it was the corpse of a person. When it drifted so close that he could almost touch it, he suddenly recognized the dead body - it was his own! He lost all control and wailed at the sight of himself, still and lifeless, drifting along the river's currents. That moment was the beginning of his liberation.
you're respected among your peers
I'd like to buy you a beer
you look fantastic!  Have you lost weight?
give me five, brother!
Your hair looks amazing.
Once upon the time there was an old farmer who had worked his crops for many years. One day his horse ran away. Upon hearing the news, his neighbors came to visit. "Such bad luck," they said sympathetically. "Maybe," the farmer replied. The next morning the horse returned, bringing with it three other wild horses. "How wonderful," the neighbors exclaimed. "Maybe," replied the old man. The following day, his son tried to ride one of the untamed horses, was thrown, and broke his leg. The neighbors again came to offer their sympathy on his misfortune. "Maybe," answered the farmer. The day after, military officials came to the village to draft young men into the army. Seeing that the son's leg was broken, they passed him by. The neighbors congratulated the farmer on how well things had turned out. "Maybe," said the farmer.
You're really good at what you do.
You are always so happy and kind to people, it's like a big breath of fresh air when I walk into the building and see you here
Smart girls want to be called pretty and pretty girls want to be called smart.
Infuse your life with action. Don't wait for it to happen. Make it happen. Make your own future. Make your own hope. Make your own love. And whatever your beliefs, honor your creator, not by passively waiting for grace to come down from upon high, but by doing what you can to make grace happen... yourself, right now, right down here on Earth.
One day the Master announced that a young monk had reached an advanced state of enlightment. The news caused some stir. Some of the monks went to see the young monk. "We heard you are enlightened. Is that true?" they asked. "It is," he replied. "And how do you feel?" "As miserable as ever," said the monk. 
There once lived a great warrior. Though quite old, he still was able to defeat any challenger. His reputation extended far and wide throughout the land and many students gathered to study under him. One day an infamous young warrior arrived at the village. He was determined to be the first man to defeat the great master. Along with his strength, he had an uncanny ability to spot and exploit any weakness in an opponent. He would wait for his opponent to make the first move, thus revealing a weakness, and then would strike with merciless force and lightning speed. No one had ever lasted with him in a match beyond the first move. Much against the advice of his concerned students, the old master gladly accepted the young warrior's challenge. As the two squared off for battle, the young warrior began to hurl insults at the old master. He threw dirt and spit in his face. For hours he verbally assaulted him with every curse and insult known to mankind. But the old warrior merely stood there motionless and calm. Finally, the young warrior exhausted himself. Knowing he was defeated, he left feeling shamed. Somewhat disappointed that he did not fight the insolent youth, the students gathered around the old master and questioned him. "How could you endure such an indignity? How did you drive him away?" "If someone comes to give you a gift and you do not receive it," the master replied, "to whom does the gift belong?"
People often say that motivation doesn't last. Well, neither does bathing -that's why we recommend it daily.
It is hard to fail, but it is worse never to have tried to succeed. (Theodore Roosevelt)
The only way of finding the limits of the possible is by going beyond them into the impossible. (Arthur C. Clarke)
Happiness resides not in possessions and not in gold; the feeling of happiness dwells in the soul. (Democritus)
The happiness of your life depends upon the quality of your thoughts; therefore guard accordingly. (Marcus Aurelius)
People with many interests live, not only longest, but happiest. (George Matthew Allen)
Happiness is not achieved by the conscious pursuit of happiness; it is generally the by-product of other activities. (Aldous Huxley)
I am more and more convinced that our happiness or unhappiness depends far more on the way we meet the events of life, than on the nature of those events themselves. (Baron Alexander von Humboldt)
Who is the happiest of men? He who values the merits of others, and in their pleasure takes joy, even as though 'twere his own. (Johann Wolfgang von Goethe)
HI! Found you through Sugardoodle on Facebook today.. and I am so glad you did!! You have great ideas! I am looking forward to exploring your blog!! Thanks !
You're doing some amazing work!
You've got a good head on your shoulders.
People seem to like you.
I like you!
Everyone says you're the greatest!
Have you played the Rice Game yet?
looking good today!
this above allthings: Know thyself.
Confuscious say: Man who sleeps with itchy bum wakes with smelly finger
WAre you drinking enough water?
Don't you think it's time you otok a short break?
OLM loves you!
Isn't this better than working at Toneplus?
It's party time!!


hi all.

look for simple expression. i want to choose my rotation when the particle hit the floor with a little bit of random.

like : rotationPP = rand (95,120); but with this the particle keep changing every frame between 95,120.
i tried to : rotationPP = 95 && 120; but doesnt work.

hope its clear :).



Ok, so what you want to do is have a switch which activates every time the particle collides. To do this - add a new attribute to the particle called “hit” Make it a float, perparticle attribute. got it?

Now, you want to add a little checker to your runtime before dynamics that compares the “eventCount[0]” attribute to the “hit” attribute. “EventCount[0]” automatically increases every time a particle collides - so by default the particle knows its own collision counter.

$count = eventCount[0];
if ($count != $hit){$rotation = $newValue; $hit = $count;}

One more thing to add is that you may want to add a condition that skips this process if the particle is resting on the ground. To do that you can add somehting like this;

$velocity = velocity;
$tolerance = 0.1;

if ($velocity > $tolerace){
$count = eventCount[0];
if ($count != $hit){$rotation = $newValue; $hit = $count;}


Hey. I had the idea to combine 3 standard commands in one toggle.


Originally selected face. When you press one key is too much between the outer vertices, edges, and a return to the inner face or the face group.

I think it’s quite simple to implement with the help of programming and it will be a useful tool. I am hope for your help. Thank you!


how do I capture the image resizing behavior of maya’s file browsing image preview pane (usually docked to the right of the file browsing pane)?

I need to resize any image to fit within its parent. Right now I have the parent set to a formLayout, should I be using something else? Maya’s documentation is quite bad.



How do mimic the image resizing behavior of Maya’s image preview pane in the file browser?

i.e. how do I tell maya to dynamically resize an image to fit within its parent? Right now I’m using formLayout, should I be using something else?


Hi Guys,

I am a newbie and having trouble running this script.Can you guys please help me with this script, When I run the exe file, it is giving me an error


Hello, I’m pretty new to MEL and I ran into a problem I can’t figure out.
I basically have an array, lets say its $array [] = {1, 2, 3, 4, 5, 6}; I want a way for it to add all of the previous iterations to each element in the array so in this example I would end up with 1,3,6,10,15,21. 1 is 1. 2+1 is 3. 3+2+1 is 6 and so forth. Ideally I’m trying to find a way for it to work no matter how many numbers are in the array.
I’m basically stuck trying to make this in a way that isn’t overly complicated.

Right now I have a start but it seems like a complicated way that only allows me to use a determined number of array elements. I feel like I’m going about this the wrong way. If anyone could help me out it would be much appreciated! Thanks!

What I have so far:

int $array[]= {1, 2, 3, 4, 5, 6};
int $g;
for ($g = 0; $g < size($ar); $g++) {
if ($g - 1 > -1) {
print ($array[$g] + $array[$g -1] + "
") ;
else {
print ($array[$g]+ "