Your Cart

Create button for 3ds Max Scripts

Sometimes when you download a script from the internet (usually has the extension .ms or .mse), it only executes once when you drag and drop it into the 3ds Max viewport. So, every time you use it, you will have to drag and drop it again.

In this article, I will show you how you can create MacroScripts from a Script file, so you can assign shortcuts for it or put it in 3ds Max toolbars.

Note that I assume you already know the basics of how to create a custom toolbar. If you don’t know it, learn about how to create a custom toolbar and how to add buttons to it.

MacroScript vs Script?

MacroScripts is a special type of script, usually with the extension mcr.

In addition to executing the main commands of a regular script, it will also execute an additional action called Defining Macro Scripts. This action is used to create items in the Custom User Interface (toolbar buttons, Menu or QuadMenu items, and keyboard shortcuts).

Therefore, to create a button for a script, you need to create a corresponding MacroScript for it.

Note that some developers release MacroScript in regular script format (.ms), although it still works, this practice is generally not popular. These files usually only appear in the MaxScript installation package (.mzp).

Create MacroScript from Script

There are 3 most common methods to create a MacroScript from Script. All of these methods will create a .mcr file in the User Macros folder, which will be loaded every time 3ds Max starts.

You can locate the User Macros folder in Customize > Configure System Paths > Additional Macros. You can manage the macros you create here, and share them with others if you want. By default, it is located at AppData > Local > Autodesk > 3dsMax > 20xx – 64bit > ENU > usermacros.

Method 1 – Drag and Drop

This is the easiest and fastest of all methods, suitable for simple scripts.

  • Step 1: Open MAXScript Editor by Main Menu > Scripting > MAXScript Editor…
  • Step 2: Open the script you want to create MacroScript by File > Open.
  • Step 3: Select all the codes by Ctrl + A, then drag and drop them into the 3ds Max toolbar.

After completing the above steps, a new button will appear on the toolbar, and 3ds Max will automatically define a MacroScript corresponding to the script you just dragged and dropped into.

You can right-click this button, and select Edit Button Appearance or Edit Macro Script to edit its name, label, tooltip, and icon.

MacroScripts created using this method will by default be located in the DragAndDrop category in the Custom User Interface.

Method 2 – Manually Defined

The most basic format of a Macro Script is as follows:

macroScript ScriptName 
category: "Category Name"
tooltip: "Script Label"
buttonText: "Button Label"
(
...
)

Step 1: Open MAXScript Editor by Main Menu > Scripting > MAXScript Editor…

Step 2: Copy and paste the code string above. Replace ScriptName, CategoryName, Script Label, and Button Label with the names you want. Note that ScriptName must be one solid word, with no spaces and no special characters in-between.

Step 3: You have 2 options. You can copy the entire code of the original script, and paste it in place of the line , or use the following command:

on execute do fileIn "path_to_script"

Replace path_to_script with the path to the original script file. For example:

macroScript SmartCameraView3
category: "D95 DESIGN"
tooltip: "Smart Camera View 3"
buttonText: "SCV"
(
	on execute do fileIn "C:\Script\Smart_Camera_View_3.mse"
)

Step 4: execute the script using Tools > Evaluate All (Ctrl E).

After completing the above steps, an item will appear in the CategoryName category in the Custom User Interface. You can set a keyboard shortcut or create a button for it.

Method 3 – Using Script

This method is the most convenient way for newbies. First, download this Macroscript Creator script by Swordslayer aka Vojtech Cada:

https://www.scriptspot.com/3ds-max/scripts/macroscript-creator

Step 1: Open Macroscript Creator by Scripting > Run Script.

Step 2: After opening the script, replace Category, Script ID, Button Text, Tooltip with the names you choose. Select the script with the button in the Script Path section.

Step 3: Press Execute button.

After completing the above steps, an item will appear in the CategoryName category in the Custom User Interface. You can set a keyboard shortcut or create a button for it.