Discover Intellipad commands using PowerShell

by Doug Finke on November 4, 2008

in Intellipad, PowerShell

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.

image

Filtering

image

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 |
 }

Download Get-IntellipadCommands Code

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>