Overview
This example provides an introduction to the script calls that allow you to add menu items to the DIAdem menus.
Description
You can easily access the DIAdem menus from a script (.vbs) file using the commands MenuItemAdd, MenuItemChange, MenuItemCountGet, MenuItemDel, MenuItemInfoGet, MenuItemInsert, and MenuReset. See DIAdem Help for more information on any of these functions. Menus locations are referenced numerically, where the first number is the menu position across the tool bar (File = 1, Edit = 2, etc), the second number is the vertical position in the menu, and any numbers after that denote a vertical location on a submenu. For example, 4.1.4.2 would refer to the fourth menu ("Settings" in the SCRIPT Window), the first item in that menu ("Options"), the fourth item in the Options submenu ("Extensions"), then the second item in the Extensions submenu ("User Commands...").
The example creates a new menu, shows how to add items and submenus, how to disable already present items, and how to remove the custom menu.

Steps to Implement or Execute Code
Requirements
Software
DIAdem 2011 or later
This code has not been verified on versions of DIAdem prior to 2011. Functionality is not guarunteed.
Script Snippet
' Create new custom menu item
Call MenuItemAdd("SCRIPT","7","PopUp","My Custom Functions")
' Add a new item to the menu
Call MenuItemAdd("SCRIPT","7.1","MenuItem","Call a Script","ScriptStart(""MyScript"")")
' Add a separator to the menu
Call MenuItemInsert("SCRIPT","7.2","Separator")
' Restores default settings for the menu
Call MenuItemAdd("SCRIPT","7.3","MenuItem","Reset","MenuReset")
' Add a sub-menu item along with respective items
Call MenuItemInsert("SCRIPT","7.4","PopUp","Analysis Functions")
Call MenuItemInsert("SCRIPT","7.4.1","MenuItem","Calc 1","MsgBox(""Insert Calc 1 here"")")
Call MenuItemInsert("SCRIPT","7.4.2","MenuItem","Calc 2","MsgBox(""Insert Calc 2 here"")")
Note: MyScriptDIAdem1.vbs is the script that is called from the menu.
**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.