Skip to content

Instantly share code, notes, and snippets.

@paulwinex
Created December 5, 2017 11:11
Show Gist options
  • Save paulwinex/047bfa9dec720fff336aa22716e36854 to your computer and use it in GitHub Desktop.
Save paulwinex/047bfa9dec720fff336aa22716e36854 to your computer and use it in GitHub Desktop.
def doSomething():
print 'OK'
def createTestMenu(name):
if not MaxPlus.MenuManager.MenuExists(name):
mb = MaxPlus.MenuBuilder(name)
action = MaxPlus.ActionFactory.Create('Do something', 'Action 1', doSomething)
if action._IsValidWrapper():
print "Created action"
else:
print "Failed to create action"
mb.AddItem(action)
mb.AddSeparator()
menu = mb.Create(MaxPlus.MenuManager.GetMainMenu())
print 'menu created', menu.Title
else:
print 'The menu ', name, ' already exists'
createTestMenu('My Menu')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment