script creates new menu on each startup

i have an script from FSX SDK, but everytime i start max (2008 x32) it creates a new "Aces Tools" menu on my menu toolbar. i have to remove one each time i start, otherwise they'll reproduce as rabbits and populate my entire menu bar.

heres the script:

--Get the text for the macro scripts to be created from existing scripts
macroScript ExportLOD category:"Tools" tooltip:"Export and LOD tool"
(
	try (execute (openFile (acesPluginRoot + acesMax9ScriptsFolder + "\\ExportAndLOD.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroScript UVToolSuite category:"Tools" tooltip:"UV Suite Deluxe"
(
	try (execute (openFile (acesScriptsFolder + "\\UVSuiteDeluxe.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroScript containerCreator category:"Tools" tooltip:"Build Container Tool"
(
	try (execute (openFile (acesScriptsFolder + "\\BuildContainerTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript wheelTool category:"Tools" tooltip:"Wheel animation tool"
(
	try (execute (openFile (acesScriptsFolder + "\\WheelsSetupTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript fileRenamer category:"Tools" tooltip:"Rename Flightsim File"
(
	try (execute (openFile (acesScriptsFolder + "\\RenameFile.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript AttachPointTool category:"Tools" tooltip:"Attach Point Tool"
(
	try (execute (openFile (acesScriptsFolder + "\\AttachPointTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript FSCloudTool category:"Tools" tooltip:"Flight Simulator Cloud Tool"
(
	try (execute (openFile (acesScriptsFolder + "\\CloudTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript FSXShaderTool category:"Tools" tooltip:"Update to and Work with FSX Shaders"
(
	try (execute (openFile (acesPluginRoot + acesMax9ScriptsFolder + "\\FSXShaderTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript FSXMatEditorTool category:"Tools" tooltip:"Edit materials in the Materials.xml file"
(
	try (execute (openFile (acesScriptsFolder + "\\MaterialEditorTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript RemoveFSXMaterials category:"Tools" tooltip:"Remove FSX materials from scene"
(
	try (execute (openFile (acesScriptsFolder + "\\RemoveFSXMat.ms"))) catch (messageBox "This tool is currently not supported.")
)
macroscript AnimationManager category:"Tools" tooltip:"Start the FSX Animation Manager"
(
	StartFSXAnimationEditor();
)
 
try (fileIn (acesScriptsFolder + "\\Startup\\XMakeFootprint.ms")) catch ()
macroscript MakeFootprint category:"Tools" tooltip:"Make footprints per city"
(
	if usingAcesBuild then
	(
		setupFootprintUI ()
	)
	else
	(
		messageBox "This tool is currently not supported."
	)
)
 
macroscript FSMobileSceneryTool category:"Tools" tooltip:"Mobile Scenery Offset Tool"
(
	try (execute (openFile (acesScriptsFolder + "\\MobileSceneryTool.ms"))) catch (messageBox "This tool is currently not supported.")
)
 
newMenuID = genClassID returnValue:true
if menuMan.registerMenuContext newMenuID[1] then
(
	mainMenuBar = menuMan.getMainMenuBar ()
	subMenu = menuMan.createMenu "Aces Tools"
	exportItem = menuMan.createActionItem "ExportLOD" "Tools"
	if usingAcesBuild then UVScaleItem = menuMan.createActionItem "UVToolSuite" "Tools"
	if usingAcesBuild then containerItem = menuMan.createActionItem "containerCreator" "Tools"
	wheelToolItem = menuMan.createActionItem "wheelTool" "Tools"
	if usingAcesBuild then fileRenamerItem = menuMan.createActionItem "fileRenamer" "Tools"
	attachItem = menuMan.createActionItem "AttachPointTool" "Tools"
	fsxMatItem = menuMan.createActionItem "FSXShaderTool" "Tools"
	if usingAcesBuild then fsxMatEditorItem = menuMan.createActionItem "FSXMatEditorTool" "Tools"
	if usingAcesBuild then removeFSXItem = menuMan.createActionItem "RemoveFSXMaterials" "Tools"
	fsxAnimItem = menuMan.createActionItem "AnimationManager" "Tools"
	if usingAcesBuild then makeFPItem = menuMan.createActionItem "MakeFootprint" "Tools"
	cloudItem = menuMan.createActionItem "FSCloudTool" "Tools"
	if usingAcesBuild then msoTool = menuMan.createActionItem "FSMobileSceneryTool" "Tools"
	subMenu.addItem exportItem -1
	subMenu.addItem fsxMatItem -1
	subMenu.addItem fsxAnimItem -1
	subMenu.addItem attachItem -1
	if usingAcesBuild then subMenu.addItem UVScaleItem -1
	subMenu.addItem wheelToolItem -1
	subMenu.addItem cloudItem -1
	if usingAcesBuild then subMenu.addItem fsxMatEditorItem -1
	if usingAcesBuild then subMenu.addItem containerItem -1
	if usingAcesBuild then subMenu.addItem fileRenamerItem -1
	if usingAcesBuild then subMenu.addItem removeFSXItem -1
	if usingAcesBuild then subMenu.addItem makeFPItem -1
	if usingAcesBuild then subMenu.addItem msoTool -1
	subMenuItem = menuMan.createSubMenuItem "Aces Tools" subMenu
	subMenuIndex = mainMenuBar.numItems() + 1
	mainMenuBar.addItem subMenuItem subMenuIndex
	menuMan.updateMenuBar()
)

i believe the problem lies in the line that starts with:
"newMenuID = genClassID returnValue:true"
as if i start a comment in there, until the end of the document, every time i start 3ds max, one aces tools entry will disappear. but if i leave it like that, then i wont have the menu after some starts, so how to make it keep the menu, one time?! lol

thanks in advance

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Graph's picture

try (menuMan.unRegisterMenu

try (menuMan.unRegisterMenu (menuMan.findMenu "Aces Tools") ) catch(); menuMan.updateMenuBar()

just execute that before you register your stuff

and instead of doing all these macroscripts and stuff manually why not make it automated?

check inbox

Raphael Steves

fael099's picture

bump.........

bump.........

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.