MAXScript Introduction > Accessing MAXScript >

# Running Scripts

To run an existing script file, press "Run Script" button on the MAXScript utility rollout, File > Run Script in the Listener menu bar, or MAXScript > Run Script in the 3ds Max menu bar. This opens a common File Open dialog for choosing the script. MAXScript then reads and executes the selected script. Any output is printed to the Listener output pane.

You can also run a script from Listener or from within other scripts using the fileIn() method:

    fileIn <filename_string> [ quiet:<boolean> ]

where <filename_string> is a string literal or an expression that evaluates to a string, and specifies the name of the script file whose content is executed. The script file content is executed one expression at a time, and halts processing if an error is encountered at any point. By default, the file is not listed as it is loaded; use quiet:false to get a running listing to the Listener.

EXAMPLEUSAGES ARE:
    fileIn "my_script.ms"
or
    scriptfile="my_script.ms"fileIn scriptfile

The script file content is compiled in a global scope context, as opposed to the scope in effect when the filein() method is executed. For more information, see Scope_of_Variables.