-
Notifications
You must be signed in to change notification settings - Fork 0
Home
function Copy-HistoryItem{ [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$fg = $psise.Options.OutputPaneForegroundColor $bg = $psise.Options.OutputPaneBackgroundColor $objForm = New-Object System.Windows.Forms.Form $objForm.Text = "History" $objForm.Size = New-Object System.Drawing.Size(300,300) $objForm.StartPosition = "CenterScreen" $objForm.FormBorderStyle = "SizableToolWindow"
$objForm.KeyPreview = $True
$objForm.Add_Resize({$objlb.Size = New-Object System.Drawing.Size(($objForm.width-15),$objForm.height) })
$objlb = New-Object System.Windows.Forms.ListBox $objlb.Location = New-Object System.Drawing.Size(0,0) $objlb.Size = New-Object System.Drawing.Size(($objForm.width-15),$objForm.height) $objlb.backcolor= [system.drawing.color]::fromargb($bg.a, $bg.r, $bg.g, $bg.b) $objlb.forecolor = [system.drawing.color]::fromargb($fg.a, $fg.r, $fg.g, $fg.b) $objlb.Add_DoubleClick({$psISE.CurrentPowerShellTab.CommandPane.InsertText($objlb.Selecteditem);$objForm.Close()}) $objForm.Controls.Add($objlb)
get-history | foreach {$objlb.items.add($_.commandline)} | out-null
$objForm.Topmost = $True
$objForm.Add_Shown({$objForm.Activate()}) [void] $objForm.ShowDialog() } $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(‘Show history’,{Copy-HistoryItem},"F7")