Menu.AddCommandItem2

Introduced

v11.0 (2013)

Description

Adds a menu item at the end of the menu and attaches a command. This method is similar to Menu.AddCommandItem but specific to the python language.

C# Syntax

Object Menu.AddCommandItem2( String in_pLabel, Object in_cmd );

Scripting Syntax

oReturn = Menu.AddCommandItem2( Label, Command );

Return Value

The newly created MenuItem object.

Parameters

Parameter Type Description
Label String The menu item label.
Command String or Command The name of a command or a command object that will be invoked when the menu item is selected. This is the real name (SIObject.Name) of the command, not the Command.ScriptingName. You can find the Name of a command by running it and then checking the Edit menu (where the Name of the last executed command always appears after 'Repeat' and 'Undo'). Commands are also listed by name in the customize toolbar dialog and the scene explorer.

See Also

MenuItem Command Command.Enabled Command.ScriptingName MenuItem.Command ArgumentCollection.AddWithHandler siMenuAnchorPoints Definition Callbacks for Menus Simple Menu plug-in example