[MaxScript] Automaticly set up quad menu and macro's

Some times 3ds Max crashes, and all menu’s etc gets reset. It also corrupts the MaxStartUI files.

I’d like to create a script that automaticly sets up all of the menu’s and macros for me, but I can’t find a good way to do it. I’ve been using Maya previously, what I did there was to just define all menuItems in the userSetup.mel file, that way I could just create a bat script to copy all of the scripts whenever I switched computer or the prefs got corrupted. I was wondering if there’s something similar in 3ds Max?

You can auto-create them. Look into the menuMan (menuManager) class and methods. Essentially you can have your menus serialized somewhere, or hard code them and simply launch a script the generates them at start-up.

We go about this by using magic folders (any .ms or .py files in a sub-folder with specific name get added to the menu). If you go the dynamic route, just make sure to clear all actions out first, and find a way to track what action is autogenerated vs manually added actions.

Keep in mind however that if multiple people are creating menus and actions, it can get messy fast.

Hope this helps.

Menu Man can be a beast to learn up front, but it can certainly do what you want.

Depending on the complexity of your customization, you might be able to do it out of the box.
Max lets save all your customization under the menu Customize/Save Custom UI scheme…

at our studio we have a folder of max scripts that live far, far away from the default max folders. ( I hate digging through autodesk’s arbitrary defaults)
We have one maxscript that utilizes menuman to convert individual .ms files into macroscripts in the local user’s max folders and then builds the menus out of them.

[QUOTE=Mambo4;28547]Menu Man can be a beast to learn up front, but it can certainly do what you want.

Depending on the complexity of your customization, you might be able to do it out of the box.
Max lets save all your customization under the menu Customize/Save Custom UI scheme…

at our studio we have a folder of max scripts that live far, far away from the default max folders. ( I hate digging through autodesk’s arbitrary defaults)
We have one maxscript that utilizes menuman to convert individual .ms files into macroscripts in the local user’s max folders and then builds the menus out of them.[/QUOTE]

I have a question regarding this method of menus, I wonder if anyone can help.

I have a wrapper that launches 3dmax by pointing to a custom startup.ms, where I build all my menus. The reason I am doing it this way is because I want to keep the vanilla maya act as if my tools don’t exist. But I have two problems;

1 - Macroscripts gets copied into APPDATA, therefore goes against my whole idea of isolating things. (Not a big deal)
2 - The menu I create with menuMan.createMenu is persistent, it’s not tied to that session, so if you launch 3dmax without pointing to my startup.ms , you still see these menus. This is bad.

Is there any way around my problem n2 ? I want to build my menus dynamically ONLY from my startup.ms and don’t want them around/built any other way

thanks!

You can set up scripts that run on max shut down that remove the menu.

Create a “shutdown” script that uses menuman to unregister the menu ,
and assign it to a callback as part of your startup script.
If cleaning up the macros is still important after that, you can probably add a loop to kill them too.

Callbacks.addScript #postSystemShutdown filename:@"C:\Path\To\MyShutdownScript.ms"

id:MyShutDownScript

and then to be super tidy, within your “shutdown” script:

callbacks.removeScripts #postSystemShutdown id:MyShutDownScript

note: none of this is tested but it looks like it should work :wink:

[QUOTE=Mambo4;28989]You can set up scripts that run on max shut down that remove the menu.

Crate a shut down script that uses menuman to unregister the menu and assign it to a callback script

Callbacks.addScript #postSystemShutdown filename:@"C:\Path\To\MyShutdownScript.ms"

[/QUOTE]

I was thinking of something along that, but how about crashes, which are quite common :slight_smile:

maybe add a “remove this menu” item to your menu ?

Thanks, it seems like there is no proper way to do it. So I’ll hack up something with all these workarounds.

Thanks again for all the help!