Listener Commands

Menu Bar Commands and Keyboard Shortcuts

The following menu bar commands and keyboard shortcuts are available in Listener. The edit commands listed are also available in the Listener right-click menu. The menu bar commands for Macro Recorder are described in The Macro Recorder.

File > Save As, CTRL+S

Opens a common File Save dialog for choosing a file name to which the current contents of the active Listener pane is stored. All text in the active pane is saved to the specified file.

File > New Script, CTRL+N

Opens a new Scripting Editor window used for writing a new script.

File > Open Script, CTRL+O

Opens a common File Open dialog for choosing an existing script file. A new Scripting Editor window displays the contents of the selected script file.

File > Run Script, CTRL+R

Opens a common File Open dialog for choosing an existing script file. The selected script file contents are executed.

Edit > Undo, CTRL+Z

If the last change made to the Listener’s content was an edit, undoes that edit. Only one level of undo is supported. If the last change was a command evaluation, removes all the text printed in Listener by that command, making it easy to remove large print-outs. Pressing Ctrl+Z a second time restores the removed text and also selects it. This feature can be used as a quick way to cut or copy a command's output.

Edit > Cut, CTRL+X

Copies the selected text to the cut/paste buffer and deletes the text.

Edit > Copy, CTRL+C

Copies the selected text to the cut/paste buffer.

Edit > Paste, CTRL+V

Places the text in the cut/paste buffer at the cursor. If text is selected when executing this command, the selected text is replaced with the cut/paste buffer contents.

Edit > Delete, DEL

Deletes the selected text.

Edit > Clear All

Deletes all text in the active Listener pane.

Edit > Select All, CTRL+A

Selects all text in the active Listener pane.

Search > Find, CTRL+F

Displays Find dialog. Performs search in the active Listener pane for the Find What text. Search can be restricted to occurrences that are not part of a larger word, or are the exact combination of uppercase and lowercase letters as the Find What text. If matching text is found, the text is selected.

Search > Find Next, CTRL+G

Repeats the last Search > Find by finding and selecting the next occurrence of the Find What text in the active Listener pane.

Search > Replace, CTRL+H

Displays Replace dialog. Performs search in the active Listener pane for the Find What text, and replaces the matching text with the Replace With text. Search can be restricted to occurrences that are not part of a larger word, or are the exact combination of uppercase and lowercase letters is the specified text.

Help > Help

Displays the MAXScript Online Reference.

Help > About MAXScript

Displays About MAXScript dialog.

CTRL+B

Selects the text in the current brackets. Bracket balancer lets you check bracket balancing in long pieces of code. The balancer works with any of the following: (), [], and {}. To use it, place the cursor anywhere in the script text and press CTRL+B. If the cursor is next to a bracket, the code bracketed by it and its matching bracket will be selected and highlighted. If the cursor is not next to a bracket, the closest bracketed code containing the cursor will be selected. If you press Ctrl+B again, the next outer bracketed fragment is selected, and so on. You can keep pressing Ctrl+B to move out through bracket nestings. If at any point there is a bracket mismatch, the balancer will beep and not select any text.

End-Of-Text Commands

The simplest way to use the Scripting Listener is to enter commands at the end of the existing text and press ENTER . This is called the end-of-text compilation. After each command is executed and any results are printed to the output pane, you can enter another command and press ENTER , and so on. When you write new commands at the end of the text in Listener, pressing ENTER executes the last line and inserts a new line.

Editing and Executing Mid-Text Commands

When you want to use or edit existing text in Listener, you can differentiate between inserting new lines and executing the current line as follows:

If you do not have a number pad on your keyboard, SHIFT+ENTER is an alternative to the Number-Pad ENTER key.

Note:

In Python mode, commands are always executed using Shift+Enter or Number-Pad ENTER.

Selecting and Executing Commands

You can select multiple text lines and press SHIFT+ENTER to execute all of the selected lines. Each command in the selection is executed in the order it appears in the selection and any output is inserted after the entire selection. You can also select a portion of text within a line and press SHIFT+ENTER to evaluate it, as long as it constitutes a valid MAXScript expression. For example, you can display the value of a sub-expression in a long equation by selecting and executing only that sub-expression within a line. The output is inserted after the current line if the output pane is active, or at the current edit cursor location in the output pane if the Macro Recorder pane is active.

Executing Code Blocks

MAXScript commands may be single or multiline commands, or Block Expressions. If you want to enter a block expression or a multiline command within existing text in the Scripting Listener window, press ENTER to insert each line. Then drag-select all the lines in the command or block and press SHIFT+ENTER to execute the lines.

If you enter multiline commands or a block expression at the end of the text in the Scripting Listener window, remember that each line is compiled when you press ENTER . The multiline command is not executed until the end of the command is entered, nor are block expressions executed until the block is closed. While you cannot edit a faulty previous line within the multiline commands or block expression that has already been compiled but not yet executed, you can edit any text within the current line before you press ENTER . You can abort the current end-of-text compilation by pressing the ESC key to start over if necessary.

Note:

This feature only works for MAXScript code, you cannot execute code blocks in Python mode.

Installing Code Blocks as Macro Scripts

You can select one or more text lines and drag them to a 3ds Max toolbar to create a Macro Script containing the selected lines. For more information, see Defining Macro Scripts.