menu.addMenuCommand

Syntax menu.addMenuCommand (adrMenubar, menuName, itemString, scriptString)

Params adrMenubar is the address of a menubar object in Frontier.root.

menuName is the name of a menu contained within the menu bar.

itemString is the name of the command which you wish to add to the menu.

scriptString is the text of the script to be executed when the command is selected.

Action Adds a command named itemString to the menu named menuName in the menubar object.

Returns True.

Examples menu.addMenuCommand (@system.menus.menubar, "Custom", "Hello", "dialog.alert (user.name)")

   » true // adds a command named Hello to the end of your Custom menu

menu.addMenuCommand (@system.menubars.[FinderMenu.id], "System 7", "Hello", "dialog.alert (user.name)")

   » true // you can add commands to sub-menus too

Notes If menuName doesn't exist, it is created as a new main menu.

If itemString already appears in the menu, its script is replaced with scriptString

See Also menu.deleteMenuCommand

menu.addSubMenu

menu.setScript

Discuss