Get-IntellipadCommands | Out-GridView
This PowerShell snippet searches all the IronPython files deliver with Intellipad, looks for the key word MetaData.CommandExecuted, then extracts the Command Name, Short Cut Key, File Name and the Line Number the command was found on.
Out-GridView, delivered with PowerShell V2, displays it.
Now you can sort and filter commands and find their short cut key. Then, when you want to extend Intellipad and need an IronPython snippet to follow, you have the File Name and Line Number the command is on.
Filtering
PowerShell Code
dir 'C:\Program Files\Microsoft Oslo SDK 1.0' -r *py |
Select-String Metadata.CommandExecuted |
ForEach {
$line = $_.Line
$lparen = $line.IndexOf('(')
$line=($line.Substring($lparen+1,$line.Length-$lparen-2) -Replace "'","").Trim()
$null, $cmd, $key = $line.Split(',')
$pos = $cmd.IndexOf('}')
$cmd = $cmd.Substring($pos+1)
New-Object PSObject |
Add-Member -Passthru NoteProperty Command $cmd |
Add-Member -Passthru NoteProperty ShortCutKey $key |
Add-Member -Passthru NoteProperty LineNumber $_.LineNumber |
Add-Member -Passthru NoteProperty FileName $_.Path |
}
{ 0 comments… add one now }