There are a couple of ways to approach this, you can either define menu items via a menus file, i.e. the layEdit.menus in this case, which would reside in your ./menus/ or ~/menus directory, or you can create the menus and add them via SKILL. Here's a brief example of the bits that you might need for that approach:
procedure(AmitAddMenu(args) let( ((win args->window) item1 item2 menu) ;; create a couple of menu items item1 = hiCreateMenuItem( ?name 'item1 ?itemText "My First Item" ?callback "AmitFunctionOne()" ) item2 = hiCreateMenuItem( ?name 'item2 ?itemText "My Second Item" ?callback "AmitFunctionTwo()" ) ;; create a menu that includes the menu items menu = hiCreatePulldownMenu('AmitMenu "Amit Menu" list(item1 item2)) ;; insert this menu as the last menu hiInsertBannerMenu(win menu length(hiGetBannerMenus(win)) );let); procedure;; create a user postinstall trigger that automatically adds the menudeRegUserTriggers("maskLayout" nil nil 'AmitAddMenu)
You might need to add code to check if the menu is already present, but hopefully this framework gives you an idea of how to do it.
I can't really read your posted code, but it looks like you missed off the all-important deRegUserTriggers() command? This is the part that automatically runs your code, triggered by the action of opening a layout - hence, you may only need to do this once if the menu is global across all layout windows. When you open a layout window the code is triggered and it adds the menu. Job done!
Am I missing something else?
the error message appears to be self explanatory: My_Custom_Menu will be supplied with one argument that is a disembodied property list ("dpl" for short) but it was defined to accept no arguments:
*Error* My_Custom_Menu: too many arguments (0 expected, 1 given) - ...
The trigger will automatically supply the dpl to the function, this is why the function needs to accept at least one argument. See my example where I have "args" for this argument, and then this is used to obtain the window id (this is the correct way to do it anyway, since hiGetCurrentWindow() can actually pick up the "What's New" window, for example).
Also, which version are you using? I'd guess at 9502/4.3.4 given the "dag" prefixed functions, but it is possible that these are just customizations...
Try again and let us know how things turn out.