DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

MenuItemInfoGet

Can someone tell me, why the following script brings up the menuitem "testmenu" multiple times?
0 Kudos
Message 1 of 2
(3,376 Views)
This behaviour is really strange. If you start the sequence from your editor, everything is working fine. For debigging I added a msgbox in a cetrain line of the script - and suddenly the error did not occure any more. That is why I am not sure what is causing the problem. Nevertheless, I found a workaround.
DIAdem cannot dekete the testmenu if the menu itself is calling the script. In such case, the menuItemInfoGet function will return an emty string for the menu title. I added the empty string comparison to the if THen structure. To prevent the program to dissappear in an endless loop you have to check the menus backwards (step -1 in the for-loop)



sTemp1 = "SCRIPT"
Call MenuItemCountGet(sTemp1,"M")
iTemp1 = menuitemcount'Deleting existing Menus
for iIndex
1 = iTemp1 to 1 step -1
call MenuItemInfoGet(sTemp1, iIndex1)
if (MenuItemTitle = "testmenu") or (Menuitemtitle="") then
call MenuItemDel(sTemp1, iIndex1)
end if
next
Call MenuItemadd(sTemp1,iTemp1 + 1,"MENUITEM","testmenu","scriptstart("""&autoactpath&"menutest3.vbs"")")
0 Kudos
Message 2 of 2
(3,376 Views)