Your Ad Here

Run MEL commands

Run a single MEL command

Type a command in the command line at the bottom of the Maya main window.

If the command line is not visible, you can turn it on by choosing Display > UI Elements > Command Line.

To...
Do this

Execute a command and return the keyboard focus to the view windows so you can use hotkeys.

Type the command press the Enter or Return key.

Execute a command and leave the keyboard focus in the command line.

Type the command and press the Enter key on the numeric keypad.

Scroll through the history of commands.

Press up and down in the command line.

Create and run a MEL script

Click the Script editor button in the bottom right of the main Maya window, or select Windows > General Editors > Script Editor to open the Script editor.

The Script editor lets you type in longer, multi-line scripts and see their output in the history pane.

Type your script in the bottom pane of the Script editor window. To execute the script do any of the following:

To execute the script in the bottom pane, do one of the following:

The script and the result appear in the top pane.

The script editor history pane shows you the line numbers that the errors have occurred on. You can turn off this option by selecting History > Line numbers in error.

You can turn off the line numbers in the bottom pane by selecting Command > Show line numbers.

Script files

You can run MEL scripts as separate files. They have the extension .mel by default.

You can execute external script files in two ways:

Note
Before executing scripts, make sure you save any data you were working on.

When you source a MEL script, local procedures are not declared or executed.

If you change a script after sourcing it, the change is not automatically picked up by Maya. You need to re-run the script with File > Source Script.

Note
MEL scripts and mayaAscii files are different things. If you rename a .ma file to a .mel file and source it, you may get errors. Alternatively, if you rename a .mel script to be a .ma file and open it, you may get errors or even crash Maya. Maya does special things while reading files to improve performance and not all commands are compatible with this.

 

Return to Autodesk Index


Your Ad Here