Het Object ISEMenuItemThe ISEMenuItem Object

2 minuten om te lezen

Medewerkers

In dit artikel

Een ISEMenuItem object is een exemplaar van de klasse Microsoft.PowerShell.Host.ISE.ISEMenuItem.An ISEMenuItem object is an instance of the Microsoft.PowerShell.Host.ISE.ISEMenuItem class.Alle menu-objecten in de invoegtoepassingen menu zijn exemplaren van de Microsoft.PowerShell.Host.ISE.ISEMenuItem klasse.All menu objects on the Add-ons menu are instances of the Microsoft.PowerShell.Host.ISE.ISEMenuItem class.

EigenschappenProperties

DisplayNameDisplayName

De alleen-lezen eigenschap die de weergavenaam van de menuopdracht opgehaald.The read-only property that gets the display name of the menu item.

# Get the display name of the Add-ons menu item
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
$psISE.CurrentPowerShellTab.AddOnsMenu.DisplayName

# Get the action associated with the first submenu item.
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action
# Invoke the script associated with the first submenu item
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action.Invoke()

# Get the shortcut for the first submenu item.
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Shortcut

# This is a scripting example that shows the use of the Add-ons menu.
# Clear the Add-ons menu if any entries currently exist
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
# Add an Add-ons menu item with an shortcut and fast access key.
# 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")
# Add a nested menu - a parent and a child submenu item.
$parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("Parent",$null,$null)
$parentAdded.SubMenus.Add("_Dir",{dir},"Alt+D")