Het ISEMenuItemCollection-object

Een ISEMenuItemCollection-object is een verzameling ISEMenuItem-objecten . Het is een exemplaar van de klasse Microsoft.PowerShell.Host.ISE.ISEMenuItemCollection . Een voorbeeld is het $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus object dat wordt gebruikt om het menu Invoegtoepassing in Windows PowerShell® Integrated Scripting Environment (ISE) aan te passen.

Methode

Add(string DisplayName, System.Management.Automation.ScriptBlock Action, System.Windows.Input.KeyGesture Shortcut )

Ondersteund in Windows PowerShell ISE 2.0 en hoger.

Hiermee voegt u een menu-item toe aan de verzameling.

DisplayName De weergavenaam van het menu dat moet worden toegevoegd.

Actie Het object System.Management.Automation.ScriptBlock waarmee de actie wordt opgegeven die is gekoppeld aan dit menu-item.

Sneltoets De sneltoets voor de actie.

Retourneert het ISEMenuItem-object dat zojuist is toegevoegd.

# Create an Add-ons menu with a fast access key and a shortcut.
# Note the use of "_"  as opposed to the "&" for mapping to the fast access key letter for the menu item.
$menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Process', {Get-Process}, 'Alt+P')

Clear()

Ondersteund in Windows PowerShell ISE 2.0 en hoger.

Hiermee verwijdert u alle submenu's uit het menu-item.

# Remove all custom submenu items from the AddOns menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()

Zie ook