MacroScripts for New Users

MacroScripts were first introduced in 3ds Max 3. They were originally implemented to accommodate the output of the Macro Recorder (thus the name) and were intended for use as buttons on the toolbars. A MacroScript is generated automatically when scripting code (from the MacroRecorder output, from the MAXScript Listener or from a MAXScript editor) is dragged and dropped onto a toolbar. The new scripts have the extension .mcr and are written to the UI\MacroScripts folder.

To create a MacroScript using Drag And Drop:

1. Select some code in the MacroRecorder output, the MAXScript Listener or in a MAXScript editor.

2. Click and Drag the selection to a toolbar while holding the left mouse button pressed.

3. Drop the selection on the toolbar by releasing the left mouse button.

Result: A new button will be created, showing a generic MacroScript icon. The new script will be named "MacroN" where N is a unique number incremented after each drag and drop operation. The category of the new script will be "DragAndDrop".

 

Later in 3ds Max 4, the UI has been extended to allow the usage of MacroScripts as ActionItems in Menus, QuadMenus, Toolbars and Keyboard Shortcuts. Currently, this is probably the most common form of scripts found in 3ds Max and is vital to UI customizability.

Of course, a script developer can write the same form of scripts manually or use automatically generated MacroRecorder code as template for manual enhancements. The developer’s source code might also be contained in an .ms file.

A typical MacroScript will usually start like this:

macroScript scriptName category:"CategoryName"

(

...

)

Note the category: name. You will need this name in order to be able to quickly locate the script in the Customize dialog.

To install a MacroScript:

1a. Click the MAXScript item in the Main Menu, select Open Script...

1b. Alternatively, go to the Utilities panel, open the MAXScript Utility, press Open Script...

2. Locate and select the script and press Open.

3. Note the name of the MacroScript and the Category name.

4. In the MAXScript Editor, click File and select Evaluate All or press Ctrl+E. This will evaluate the script.

5. Go to Customize > Customize User Interface and select the desired Tab (Keyboard, Toolbars, Quads or Menus)

6. Locate the Category you noted in 3.

7. Search in the Category for the name you noted in 3.

8. Drag the script to the toolbar, Menu or QuadMenu or assign to a Shortcut.

An evaluated MacroScript appears in the Customize... dialog’s categories list of Action Items. The evaluated version of the script remembers its source’s location. As soon as a MacroScript ActionItem is being assigned to a Toolbar, Menu, QuadMenu or Shortcut, a copy of the source will be automatically written to the UI\MacroScripts folder with a new name comprised of the Category Name, the MacroScript’s name and the .mcr extension.

If you change or update the script by evaluating a newer / different version with the same name and category, the copy of the script in UI\MacroScripts will be overwritten with the actualized version.

All scripts in UI\MacroScripts will be automatically evaluated on startup and will be available to the user in future sessions. To remove a MacroScript permanently, you should remove the respective .mcr file from UI\MacroScripts.

It is not advisable to have any MacroScript sources in autostart folders like the \Scripts\Startup or the plug-in paths as this would mean a double evaluation of the same source code from two different locations. Store sources of MacroScripts (your own creations, free downloads from the web or commercial scripts) at paths that are not listed in your Configure Paths dialog. This way only the automatically managed content of the UI\MacroScripts folder will be used by 3ds Max.

See also

Startup Scripts

Topics:

MAXScript for New and Casual Users

Scripted Utilities for New Users

Scripted Plug-ins for New Users

Scripted Functions for New Users

MAXScript DLX Extensions for New Users