ISEMenuItem Nesnesi

ISEMenuItem nesnesi, Microsoft.PowerShell.Host.ISE.ISEMenuItem sınıfının bir örneğidir. Eklentiler menüsündeki tüm menü nesneleri Microsoft.PowerShell.Host.ISE.ISEMenuItem sınıfının örnekleridir.

Özellikler

Gösterim Adı

Windows PowerShell ISE 2.0 ve sonrasında destekleniyor.

Menü öğesinin gösterim adını alan yalnızca okunabilir özellik.

# 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

Eylem

Windows PowerShell ISE 2.0 ve sonrasında destekleniyor.

Script bloğunu alan sadece okunabilir özellik. Menü öğesine tıkladığınızda eylemi çağırıyor.

# 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()

Shortcut

Windows PowerShell ISE 2.0 ve sonrasında destekleniyor.

Menü öğesi için Windows giriş klavye kısayolunu alan yalnızca okunma özelliği.

# 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

Windows PowerShell ISE 2.0 ve sonrasında destekleniyor.

Menü öğesinin alt menü listesini alan yalnızca okunabilir özellik.

# List the submenus of the Add-ons menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Process', {Get-Process}, 'Alt+P')
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus

Script örneği

Eklentiler menüsünün ve scriptlenebilir özelliklerinin kullanımını daha iyi anlamak için aşağıdaki script örneğini okuyun.

# 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 a 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')

Ayrıca Bkz.