Hi All,
I am using Primal Forms to create a GUI for a script that will display the AD Information about the user account.
The code below works but the output is difficult to read, is there any way i can format it to make is more readable?
#Generated Form Function function GenerateForm { ######################################################################## # Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0 # Generated On: 18/10/2012 16:27 # Generated By: adminnp ######################################################################## #region Import the Assemblies [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null #endregion #region Generated Form Objects $form1 = New-Object System.Windows.Forms.Form $richTextBox1 = New-Object System.Windows.Forms.RichTextBox $textBox1 = New-Object System.Windows.Forms.TextBox $button1 = New-Object System.Windows.Forms.Button $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState #endregion Generated Form Objects #---------------------------------------------- #Generated Event Script Blocks #---------------------------------------------- #Provide Custom Code for events specified in PrimalForms. $processData= { #TODO: Place custom script here $richTextBox1.Text = $richTextBox1.Text.Clear $user=($textBox1.TEXT) Get-ADUser -Filter {SamAccountName -eq $user} -Properties * -OutVariable data foreach ($line in $data) { $richTextBox1.Appendtext(($line | Select * | Out-String )) } } $handler_form1_Load= { #TODO: Place custom script here } $OnLoadForm_StateCorrection= {#Correct the initial state of the form to prevent the .Net maximized form issue $form1.WindowState = $InitialFormWindowState } #---------------------------------------------- #region Generated Form Code $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 536 $System_Drawing_Size.Width = 748 $form1.ClientSize = $System_Drawing_Size $form1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 347 $System_Drawing_Point.Y = 182 $form1.Location = $System_Drawing_Point $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 574 $System_Drawing_Size.Width = 764 $form1.MaximumSize = $System_Drawing_Size $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 574 $System_Drawing_Size.Width = 764 $form1.MinimumSize = $System_Drawing_Size $form1.Name = "form1" $form1.Text = "User Info Tool" $form1.add_Load($handler_form1_Load) $richTextBox1.Anchor = 15 $richTextBox1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 8 $System_Drawing_Point.Y = 56 $richTextBox1.Location = $System_Drawing_Point $richTextBox1.Name = "richTextBox1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 468 $System_Drawing_Size.Width = 728 $richTextBox1.Size = $System_Drawing_Size $richTextBox1.TabIndex = 2 $richTextBox1.Text = "" $richTextBox1.font = "Arial" $form1.Controls.Add($richTextBox1) $textBox1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 160 $System_Drawing_Point.Y = 12 $textBox1.Location = $System_Drawing_Point $textBox1.Name = "textBox1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 20 $System_Drawing_Size.Width = 249 $textBox1.Size = $System_Drawing_Size $textBox1.TabIndex = 1 $form1.Controls.Add($textBox1) $button1.Anchor = 9 $button1.DataBindings.DefaultDataSourceUpdateMode = 0 $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 463 $System_Drawing_Point.Y = 12 $button1.Location = $System_Drawing_Point $button1.Name = "button1" $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 24 $System_Drawing_Size.Width = 126 $button1.Size = $System_Drawing_Size $button1.TabIndex = 0 $button1.Text = "Go" $button1.UseVisualStyleBackColor = $True $button1.add_Click($processData) $form1.Controls.Add($button1) #endregion Generated Form Code #Save the initial state of the form $InitialFormWindowState = $form1.WindowState #Init the OnLoad event to correct the initial state of the form $form1.add_Load($OnLoadForm_StateCorrection) #Show the Form $form1.ShowDialog()| Out-Null } #End Function #Call the Function GenerateForm