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 and 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 Window > 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.

NoteIn the script editor, you can use auto-completion to help you find command names more quickly. For more information, see Get help on a MEL command.

To execute the script do any 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.

Command highlighting

All MEL and Python commands are highlighted as you enter them into their respective tabs in the Script Editor.

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: