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.
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. 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.
You can run MEL scripts as separate files. They have the extension .mel by default.
You can execute external script files in two ways:
When you source a MEL script, MEL does not allow you to forward reference locally scoped procedures. Locally scoped procedure definitions must appear before they are called. For example, in a file called noForwardRef.mel, define the local procedures before they are referenced.
proc myLocalProc() { print "In myLocalProc()\n" ; } proc anotherLocalProc() { print "In anotherLocalProc()\n" ; myLocalProc; } global proc noForwardRef() { print "Calling anotherLocalProc()\n" ; anotherLocalProc; }
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.