ISEMenuItem 개체는 Microsoft.PowerShell.Host.ISE.ISEMenuItem 클래스의 인스턴스입니다. 추가 기능 메뉴의 모든 메뉴 개체는 Microsoft.PowerShell.Host.ISE.ISEMenuItem 클래스의 멤버입니다.
속성
DisplayName
메뉴의 이름을 가져오는 읽기 전용 속성입니다.
# 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 (Note the “.” At the beginning of the command). # Invoke the action $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Action.Invoke()
Shortcut
메뉴 항목의 Windows 입력 키 제스처를 가져오는 읽기 전용 속성입니다.
# 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
메뉴 항목의 하위 메뉴 목록을 가져오는 읽기 전용 속성입니다.
# 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
스크립팅 예
추가 기능 메뉴와 해당 스크립트 가능 속성의 사용에 대해 보다 잘 이해하려면 다음 스크립팅 예를 살펴보십시오.
# This is a scripting example that shows the use of the Add-ons menu. # Clear the Add-ons menu if one exists $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear() # Add an Add-ons menu with an accessor. # Note the use of “_” as opposed to the “&” for mapping to the fast key letter for the menu item. $menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") # Add a nested menu. $parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("Parent",$null,$null) $parentAdded.SubMenus.Add("_Dir",{dir},"Ctrl+Shift+D")
참고 항목