DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable menu item

Is it possible to disable menu items in user defined menus? And then later enable/disable at will in scripts?

Also, I'm having some problems with a scrip running after a menu item has been clicked. The script is supposed to (among other things) show a dialog from a .sud file.

the code is simply:
SUDDefLoad("path to sud file")
SUDDlgShow("dlgName")

When i run this script (Ctr + F5) from the script panel in DIAdem it works fine. When i restart DIAdem and then click the menu item i get an error message saying "SudDlgShow failed. Cannot find "dlgName"".
However, if i simply open the file containing the script in question in the script panel and then click the menu item again it runs fine (without having run the script with Ctrl+F5, but simply opening it for viewing).
0 Kudos
Message 1 of 4
(3,656 Views)

Hi salte,

The first thing to check is if in the code you have behind the custom menu you are in fact passing the full path to the *.SUD file or if you are instead just passing the name of the *.SUD file.  When you load a VBScript into the DIAdem-SCRIPT editor, DIAdem automatically sets the default directory for VBScripts to the directory that VBScript was loaded from.  But if you restart DIAdem and try from the menu, the default VBScript directory will revert back to being under the DIAdem program directory.

The other thing worth trying is to replace the code you showed below with a single command:

Call SudDlgShow("dlgName", "full path to sud file")

I seem to remember that in DIAdem 10.0 there was some issue with using those 2 commands instead of the 1 command above (which I always use).

Finally, I always make use of the AutoActPath variable to point to a *.SUD file in the same directory as the calling *.VBS file.  I find that makes the whole application wonderfully portable-- which would look like this:

Call SudDlgShow("dlgName", AutoActPath & "name of sud file")

Hope that helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,640 Views)
Thanks again Brad, your second suggestion solved the problem (passing both the dialog name and the path as parameters in one call).

However, you did't comment on the "disable menu item" issue. Do you (or anyone else) know if this is possible at all?
0 Kudos
Message 3 of 4
(3,617 Views)

Hi salte,

I was checking with R&D to be sure of my answer.  Unfortunately, there is no way to disable a custom menu item in DIAdem.  You can only make it disappear and reappear, which is less clear to the user.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 4
(3,610 Views)