Freitag, 28. August 2009

ISE Find hotkeys in ISE custom menus

I (bernd_k) just ask on twitter

#powershell #ise is there a way to see which hotkeys are used or available?

Nearly at once I got a reply from

$psise.CurrentPowerShellTab.AddOnsMenu.Submenus |
select Action,DisplayName,@{n='Modifiers';e={$_.Shortcut.Modifiers}},@{n='Key';e={$_.Shortcut.Key}}


This is a good start, it lists the toplevel custommenu items. Some hotkeys are by ISEs own menus. I don't know how to handle that yet, but I extended this to include the submenus:

function flaten-Menus ($m = $psise.CurrentPowerShellTab.AddOnsMenu.Submenus)
{
$m | Where-object {$_.Submenus -ne $null} | % {flaten-Menus $_.Submenus}

$m | Where-object {!$_.Submenus -ne $null} |
select Action,DisplayName,@{n='Modifiers';e={$_.Shortcut.Modifiers}},@{n='Key';e={$_.Shortcut.Key}}

}


flaten-Menus |sort key

Keine Kommentare:

Kommentar veröffentlichen