Het ISEMenuItem-object
Een ISEMenuItem-object is een exemplaar van de klasse Microsoft.PowerShell.Host.ISE.ISEMenuItem . Alle menuobjecten in het menu Invoegtoepassingen zijn exemplaren van de klasse Microsoft.PowerShell.Host.ISE.ISEMenuItem .
Eigenschappen
DisplayName
Ondersteund in Windows PowerShell ISE 2.0 en hoger.
De eigenschap Alleen-lezen die de weergavenaam van het menu-item ophaalt.
# 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
Actie
Ondersteund in Windows PowerShell ISE 2.0 en hoger.
De eigenschap Alleen-lezen waarmee het scriptblok wordt ophaalt. De actie wordt aangeroepen wanneer u op het menu-item klikt.
# 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()
Snelkoppeling
Ondersteund in Windows PowerShell ISE 2.0 en hoger.
De eigenschap Alleen-lezen die de sneltoets voor Windows-invoer voor het menu-item ophaalt.
# 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
Submenus
Ondersteund in Windows PowerShell ISE 2.0 en hoger.
De eigenschap Alleen-lezen waarmee de lijst met submenu's van het menu-item wordt weergegeven.
# 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
Voorbeeld van scripting
Lees het volgende scriptvoorbeeld voor meer inzicht in het gebruik van het menu Invoegtoepassingen en de scriptbare eigenschappen.
# 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')
Zie ook
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort beschikbaar: In de loop van 2024 zullen we GitHub-problemen geleidelijk uitfaseren als het feedbackmechanisme voor inhoud en deze vervangen door een nieuw feedbacksysteem. Zie voor meer informatie:Feedback verzenden en weergeven voor