Page 1214 - Kitab3DsMax
P. 1214
Part XII: MAXScript and Plug-Ins
MAXScript Editor windows
The MAXScript Editor window is different from the MAXScript Listener. It enables you to open and edit
any type of text file, although its most common use is for editing MAXScript files. Although you can have
only one Listener window open, you can open as many editor windows as you want. Each opened script
appears in a separate tab at the top of the Editor window.
To open a new MAXScript Editor window, you can choose MAXScript ➪ New Script, choose File ➪ New
from the MAXScript Listener window, or click the New Script button in the MAXScript rollout in the Utility
panel. You can also use MAXScript Editor windows to edit existing scripts.
To create a new script, opening both an Editor window and the Listener window is usually best. Then you
can try out things in the Listener window, and when the pieces of the MAXScript work, you can cut and
paste them into the main Editor window. Then you can return to the Listener window, work on the next
new thing, and continue creating, cutting, and pasting until the script is done.
Tip
You can also send text back to the Listener window for Max to evaluate. Just select some text with the cursor or
mouse, and press Shift+Enter (or just Enter on the numeric keypad). Max copies the selected text to the Listener
window and evaluates it for you. n
The File menu includes several commands for working with script files, including New, Open, Save, Save
As, and Revert. Another command exports the opened script to HTML, RTF, PDF, LaTeX, or XML. The
Editor also integrates with a Source Control repository. Finally, the Editor’s File menu includes the ability
to print out the opened script.
The Edit menu includes commands for undoing, redoing, cutting, copying, and pasting script sections
between different scripts and to and from the Listener window. The Match Brace and Select to Brace com-
mands let you easily create and edit scripts; the Block Comment command allows you to quickly comment
out certain areas of script; and the Make Selection Uppercase lets you quickly make variables identifiable.
The Search menu includes Find and Replace features. Another feature finds text in a directory of files. You also
can set bookmarks that allow you to quickly move to a specific point in the code. The Views menu includes
options for making the editor appear full screen. You also can expand and contract bracketed sections of the
script and display editor elements, including a toolbar, status bar, line numbers, and indentation guide.
The Tools menu includes the Evaluate All command. This command is a fast way of having Max evaluate
your entire script. The result is the same as if you had manually selected the entire text, copied it to the
Listener window, and pressed Enter. An Evaluate Selection option also is available. The Tools menu also
includes access to the Visual MAXScript window with the New Rollout and Edit Rollout menu commands.
You also have access to the various options and properties files including the User and Global Options, the
Abbreviations file, and the MAXScript Properties file, as shown in Figure 49.7.
The Macro Recorder
The MAXScript Macro Recorder is a tool that records your actions and creates a MAXScript that can be
recalled to duplicate those actions. Using the Macro Recorder is not only a quick and easy way to write
entire scripts, but it is also a great way to make a working version of a script that you can then refine. After
the Macro Recorder has created a MAXScript from your recorded actions, you can edit the script using a
MAXScript Editor window to make any changes you want.
You can turn the Macro Recorder on and off either by choosing MAXScript ➪ Macro Recorder or by choos-
ing Macro Recorder ➪ Enable in the MAXScript Listener window. The check mark next to Macro Recorder
command on the MAXScript menu indicates that the Macro Recorder is turned on.
1166