From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Modify the DIAdem Shortcut Menu

Code and Documents

Attachment

Download All

Overview

This example code will show you how to modify the DIAdem Shortcut Menu

Description

Run the attached script to modify a DIAdem Shortcut Menu, for instance, adding your own items and resetting the menu. Items can be entries into the context menu and/or separators that organize different groups of entries. You can also define what actions are performed when one of these entries is clicked, i.e. run another script, display a message popup, or reset the menu to the default settings.

Here is a snippet of the code:

Call MenuItemAdd ("VIEW", "C.19", "Separator") 'Adds a separator to the VIEW Panel's context menu
Call MenuItemAdd ("VIEW", "C.20", "MenuItem", "Test", "MsgBox(""Insert Something Here"")") 'Adds "Test" to the VIEW Panel's context menu and displays a message popup when clicked
Call MenuItemAdd ("VIEW", "C.21", "MenuItem", "Script", "ScriptStart(""Test.VBS"")") 'Adds "Script" to the VIEW Panel's context menu and runs "Test.VBS" when clicked
Call MenuItemAdd ("VIEW", "C.22", "Separator") 'Adds a separator to the VIEW Panel's context menu
Call MenuItemAdd ("VIEW", "C.23", "MenuItem", "Reset", "MenuReset(""VIEW"")") 'Adds "Reset" to the VIEW Panel's context menu and restores the default settings of the VIEW Panel's context menu when clicked

I do want to note that the REPORT panel shortcut menu cannot be modified.

Steps to Implement or Execute Code

1. Open the attached VBS files in the DIAdem Script Panel

2. Run ShortCutMenuModification_DD11.VBS

3. Navigate to the View Panel in DIAdem

4. Right-click on an area

5. Notice the three new entries at the bottom of the context menu and click on each one

Requirements

Software

DIAdem

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

Cheers,
Kelly R.
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors