Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -AssemblyName System.Windows.Forms
- Set-StrictMode -Version Latest
- $global:form = New-Object System.Windows.Forms.Form
- $global:TextBox = New-Object System.Windows.Forms.RichTextBox
- $type = New-Object "Collections.Generic.Dictionary[String, [Drawing.Color]]"
- $type["CommandArgument"] = [Drawing.Color]::Yellow
- $type["attribute"] = [Drawing.Color]::Cyan
- $type["Command"] = [Drawing.Color]::Yellow
- $type["GroupStart"] = [Drawing.Color]::Yellow
- $type["GroupEnd"] = [Drawing.Color]::Yellow
- $type["StatementSeparator"] = [Drawing.Color]::White
- $global:form.Size = New-Object System.Drawing.Size(600,300)
- $global:TextBox.BackColor = [Drawing.Color]::FromArgb(1, 36, 86)
- $global:TextBox.Dock = "Fill"
- $global:TextBox.Font = New-Object Drawing.Font("Courier New", 10,[Drawing.FontStyle]::Bold)
- $global:TextBox.Location = New-Object System.Drawing.Size(10,20)
- $global:TextBox.Size = New-Object System.Drawing.Size(500,200)
- $global:TextBox.AcceptsTab = $false
- $global:TextBox.Multiline = $true
- $global:TextBox.ScrollBars = 'Both'
- $global:form.Controls.Add($global:TextBox)
- $NL= "`r`n"
- $keys = Get-ItemProperty -Path "HKLM:SOFTWARERegistry_key_path"
- $values = @("Data", "Project", "link")
- foreach ($val in $values)
- {
- $global:TextBox.Text = $global:TextBox.Text + $keys.$val
- }
- [Management.Automation.PSParser]::Tokenize(
- $global:TextBox.Text,
- [ref](New-Object "Collections.ObjectModel.Collection[Management.Automation.PSParseError]")
- ) | % {
- $global:TextBox.SelectionStart = $_.Start - $i
- $global:TextBox.SelectionLength = $_.Length
- #skip unnecessary types
- if ($_.Type -eq "LineContinuation" -or $_.Type -eq "NewLine") {
- $i++
- }
- else {
- $global:TextBox.SelectionColor = $type[$_.Type.ToString()]
- }
- }
- $global:TextBox.DeselectAll()
- $global:form.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement