(FM10, Win XP)
Following the example in the scripting guide to add a menu with ES, I just can't get it to work. I expect the menu to appear after I run the script, which it does when I run the equivalent with the FDK. What am I missing here?
var fmMainMenu = app.GetNamedMenu("!MakerMainMenu") ;
var newMenu = fmMainMenu.DefineAndAddMenu("MyMenu1", "MyMenu1");
I tried adding a command to the menu and get no errors, but the new menu still does not appear.
Did you call UpdateMenus ( ) after adding the menus ?
Also, I found that removing the menus again somehow never works. This means that in a first trial the menu with the name MyMenu1 might already be added - even though it is not visible - and the next run of your script cannot add the same menu anymore. Adding commands to the already existing - invisible - menu will work but never make any commands available. In my trials and errors with menus I was constantly restarting FM to get rid of the previous trial menus. I know there must be a better way but it seems that some script methods do not work.
Thanks so much! That was it. Looking back at the sample, I see that I missed that part amidst all the other stuff. I thought I had read it through... apparently not.