![]()
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.
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:
- Press the Enter key on the numeric keypad
- Select Script > Execute.
- Select the text you want to execute and press
+
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:
- In the Script editor, select File > Source Script.
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.
- Place the script in one of Maya’s standard script directories. When you type the name of the file, Maya will source the contents of the file, and if a procedure with the same name exists in the file Maya will execute it. This lets you create scripts that work like built-in commands.