Macroscript installation as button in Max2022 - how?

Macroscript installation as button in Max2022 - how?

BenediZ
Collaborator Collaborator
3,432 Views
2 Replies
Message 1 of 3

Macroscript installation as button in Max2022 - how?

BenediZ
Collaborator
Collaborator

Hello,

I am having troube installing a Macroscript in Max2022.

I was used dragging it just in the toolbar from the script listener, but nothing happens.

Also the toolbar often doesn't show anything at first time, seems to be a bit buggy. I have created an own field (as always) to place own scripts and buttons

 

How can I install a Macroscript?

 

Thanks for Help

0 Likes
3,433 Views
2 Replies
Replies (2)
Message 2 of 3

10DSpace
Advisor
Advisor

@BenediZ 

 

If you literally mean you are dragging a macroscript (an .mcr)  from the listener or the editor  to a custom toolbar, then that will not work.  But if you drag an .ms file text, then Max will create a button on the toolbar and make it into a macroscript.   

 

The macroscript is just a wrapper for the .ms  which is where the actual code is.  See image below which I hope clarifies this for you.  Just drag the .ms part of the file that is within the maxscript wrapper and you will get your button on the toolbar.  Max will add the wrapper lines that declare it as a macroscript for you.  If you right click on your newly created button and select "Edit macroscript", then you will see the added lines.

 

Macroscript Installation.png 

Message 3 of 3

10DSpace
Advisor
Advisor

For completeness, I should also mention 2 ways to install a macroscipt (.mcr) in max.

 

1.  Place the .mcr file in the macroscripts folder which is typically:

 

C:\Users\[Username]\AppData\Local\Autodesk\3dsmax\2021- 64bit\ENU\usermacros

 

Then the next time you start Max, you will see it by name in the list of commands in the customize User interface dialogue.   In the example I gave above, the command would appear as "Add_Human_Size_Reference" under the category "DragAndDrop".  

 

2. More simply, you can just drag the .mcr file (not just the text, but the file itself) into a viewport in max and max will install it in the above macroscript directory.   You won't see anything happen, but it will be available right away (you don't have to restart max like you would in method 1 above) to be selected from the Customize User Interface. 

 

Just one tip:  Sometimes the name of the .mcr file itself does not exactly match the name given in the Macroscript header of the file, so it is best to first open the .mcr file in notepad to see how it's name will appear in the list of commands in the Customize User Interface dialogue.  Obviously you have the text of the entire macro in the current situation, but if in the future you get 3rd party .mcr files from somewhere, I thought I would mention it as I have encountered this. 

0 Likes