![]() |
|
ListProc GUI PowerShell Script [New Project] - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: ListProc GUI PowerShell Script [New Project] (/Thread-ListProc-GUI-PowerShell-Script-New-Project) |
ListProc GUI PowerShell Script [New Project] - ArkPhaze - 11-29-2011 Here's what i've got down so far, i'll be creating more advanced GUI projects like this in the future. But i'll admit, it's a pain in the ass not having a design view, you literally have to think up the layout in your head and calculate sizes and how to center each control. It's a little different. Code: #ListProc Powershell Script (c)AirCrypt - 2011
function CreateForm {
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
$Form1 = New-Object System.Windows.Forms.Form
$btn1 = New-Object System.Windows.Forms.Button
$rtb_text = New-Object System.Windows.Forms.RichTextBox
$label = New-Object System.Windows.Forms.Label
$btn1_click = {
$rtb_text.Text = ''
$Sys_Info = ps | ForEach-Object {
$Proc_Info = $_.Name + ' [PID:' + $_.ID + ']'
Write-Textbox $Proc_Info
}
}
$Form1_Load = {
$rtb_text.Select()
}
$Form1.Name = 'Form1'
$Form1.Text = 'ListProc PowerShell Script'
$Border_Style = New-Object System.Windows.Forms.FormBorderStyle
$Border_Style = 'FixedSingle'
$Form1.FormBorderStyle = $Border_Style
$Form1.MaximizeBox = $False
$Form1.DataBindings.DefaultDataSourceUpdateMode = 0
$Form1.BackColor = [System.Drawing.Color]::FromArgb(255,227,227,227)
$Draw_Size = New-Object System.Drawing.Size
$Draw_Size.Width = 350
$Draw_Size.Height = 575
$Form1.ClientSize = $Draw_Size
$Form1.add_Load($Form1_Load)
$rtb_text.Text = ''
$rtb_text.TabIndex = 2
$rtb_text.Name = 'rtb_text'
$rtb_text.ReadOnly = $True
$rtb_text.Font = New-Object System.Drawing.Font("Courier New",10,0,3,0)
$rtb_text.DataBindings.DefaultDataSourceUpdateMode = 0
$Draw_Size = New-Object System.Drawing.Size
$Draw_Size.Width = 330
$Draw_Size.Height = 500
$rtb_text.Size = $Draw_Size
$Draw_Point = New-Object System.Drawing.Point
$Draw_Point.X = 10
$Draw_Point.Y = 10
$rtb_text.Location = $Draw_Point
$Form1.Controls.Add($rtb_text)
$btn1.UseVisualStyleBackColor = $True
$btn1.TabIndex = 0
$btn1.Name = 'btn1'
$btn1.Text = 'Retrieve Data'
$Draw_Size = New-Object System.Drawing.Size
$Draw_Size.Width = 125
$Draw_Size.Height = 21
$btn1.Size = $Draw_Size
$Draw_Point = New-Object System.Drawing.Point
$Draw_Point.X = 110
$Draw_Point.Y = 525
$btn1.Location = $Draw_Point
$btn1.add_Click($btn1_click)
$Form1.Controls.Add($btn1)
$label.DataBindings.DefaultDataSourceUpdateMode = 0
$label.Name = 'label'
$label.Text = 'Scripted by AirCrypt'
$Draw_Size = New-Object System.Drawing.Size
$Draw_Size.Width = 125
$Draw_Size.Height = 21
$label.Size = $Draw_Size
$Draw_Point = New-Object System.Drawing.Point
$Draw_Point.X = 122
$Draw_Point.Y = 550
$label.Location = $Draw_Point
$Form1.Controls.Add($label)
$Form1.ShowDialog() | Out-Null
}
function Write-TextBox {
param([string]$text)
$rtb_text.Text += "$text`n"
}
CreateFormDemonstration: RE: ListProc GUI PowerShell Script [New Project] - ArkPhaze - 11-29-2011 No powershell coders here? lol RE: ListProc GUI PowerShell Script [New Project] - ReaperX - 12-03-2011 You Should Create a Tutorial and Maybe People Will Start to Show Interest or Curiosity.
RE: ListProc GUI PowerShell Script [New Project] - ArkPhaze - 12-03-2011 What kind of tutorial are you looking for? RE: ListProc GUI PowerShell Script [New Project] - 1234hotmaster - 12-03-2011 Agreed! btw thats cool ![]() also is powershell, Powershell.NET ? RE: ListProc GUI PowerShell Script [New Project] - ReaperX - 12-03-2011 (12-03-2011, 03:40 PM)Infinity Wrote: What kind of tutorial are you looking for? Like Basics on Powershell Scripting, How to Get Started. Stuff like that. RE: ListProc GUI PowerShell Script [New Project] - ArkPhaze - 12-03-2011 Nope, Powershell is in no way related to the .Net programming group. ![]() I'll post some tutorials up if you guys really want them, i'll create them all personal. RE: ListProc GUI PowerShell Script [New Project] - 1234hotmaster - 12-03-2011 Sure post some! btw can powershell code be compiled into a dynamic link library? RE: ListProc GUI PowerShell Script [New Project] - ArkPhaze - 12-03-2011 (12-03-2011, 03:45 PM)[ntdll.dll]x[advapi32.dll] Wrote: Sure post some! Not that I know of, I don't think it's possible. |