Notifications
Clear all

[Closed] Script in the main menu

Is there a way to costumize the UI and add .ms scripts to the main menu?

2 Replies
 JHN

Yes and no.

You can add to the main menu using


-- build menu
mainMenuBar = menuMan.getMainMenuBar()

-- declare the main tools section
theMenu = menuMan.createMenu "YourMenuName"

-- a menu has to be declared a subMenuItem in order to be assigned to another menu
theSubMenu = menuMan.createSubMenuItem "YourMenuName" theMenu
subMenuIndex = mainMenuBar.numItems() + 1
mainMenuBar.addItem theSubMenu subMenuIndex

-- now we can add entries to the theSubMenu
actionItem = menuMan.createActionItem "MacroScriptNameHere" "MacroScriptCategorieHere"
theSubMenu.addItem actionItem (theSubMenu.numItems() + 1)

--or a separator
separator = menuMan.createSeparatorItem()
theSubMenu.addItem separator (theSubMenu.numItems() + 1)

menuMan.updateMenuBar()


If you read the code carefully, you see you can only add macroscripts to a menu. So that you have to figure out, how to turn a maxscript in a macroscript (.ms -> .mcr), and then use the name and categorie to implement in the menu. This can offcourse be scripted as well.

All in all, max’ menu system is a bit of a drag to work with, but if you know your way around it, you can automate a lot of stuff, but it takes some time to come to grips with the whole innerworkings of the menu system.

-Johan

I have .mcr scripts so I’m familiar with them and how to add them to the main menu. I just have to figure out how to change my scripts to .mcr then.

Thanks!