I've written a little GUI script that gathers files from specified location,
groups files based on hashes, filenames comparison and gathers zero length files.
Each after a button press. What I'd like to do is to combine those button presses into one.
I tried converting button scriptblock to a function. And that works for single function.
I understand that I need to run those functions in parallel but I believe that there is an issue with scoping (at least). I tried using workflow parallel
(I get Write Error
) and assigning each scriptblock
to a background-job, but I think that because the jobs are then nested, everything is treated as a string object
(double hop?).
I know these can be run in simultaneously (I pressed each after another and the timer as well as progressbar appeared). So any help would be appreciated.
Add-Type -AssemblyName System.Windows.Forms
add-type -AssemblyName system.drawing
[System.Windows.Forms.Application]::EnableVisualStyles()
$window = New-Object system.Windows.Forms.Form
$window.Height = 450
$window.Width = 400
$window.StartPosition = "CenterScreen"
$window.Font = New-Object System.Drawing.Font("Calibri",11,[System.Drawing.FontStyle]::Bold )
$window.Text = "Duplicates 2.0"
$location = New-Object System.Drawing.Point(10, 10)
$size = New-Object System.Drawing.Size(365, 20)
$ProgressBar1 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar1.Location = New-Object System.Drawing.Point(10, 10)
$ProgressBar1.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar1.Style = "Marquee"
$ProgressBar1.MarqueeAnimationSpeed = 20
$ProgressBar1.UseWaitCursor = $true
$ProgressBar1.Visible = $false
$button = New-Object System.Windows.Forms.Button
$button.size = New-Object system.drawing.size @(100,50)
$button.Location = New-Object System.Drawing.Point(20, 90)
$button.TextAlign = 'middlecenter'
$button.Text = "Gather `r`n Files"
$window.Controls.add($button)
$label = New-Object System.Windows.Forms.Label
$label.Size = New-Object System.Drawing.Size @(100, 50)
$label.Location = New-Object System.Drawing.Point (135, 90)
$label.BorderStyle = 'Fixed3D'
$label.ForeColor = 'green'
$label.TextAlign = 'middlecenter'
$window.Controls.Add($label)
$check_font = New-Object System.Drawing.Font ("Calibri",20,[System.Drawing.FontStyle]::Bold)
$label3 = New-Object system.windows.forms.label
$label3.Size = New-Object System.Drawing.Size (100, 50)
$label3.Location = New-Object system.drawing.point (250 ,90)
$label3.BorderStyle = 'Fixed3D'
$label3.ForeColor = 'green'
$label3.TextAlign = 'middlecenter'
$label3.Font = $check_font
$window.Controls.Add($label3)
$label4 = New-Object system.windows.forms.label
$label4.Location = New-Object System.Drawing.Point(9, 5)
$label4.Size = New-Object System.Drawing.Size(365, 20)
$label4.TextAlign = 'middlecenter'
$label4.Text = 'COMPLETED!!!'
$label4.Visible = $false
$label4.BackColor = [System.Drawing.Color]::FromArgb(6, 176, 37)
$window.Controls.Add($label4)
$timer = New-Object System.Windows.Forms.Timer
$timer.Interval = 1000
$timer.add_Tick({$script:time2 =((get-date)-$script:time1).ToString("hh\:mm\:ss")
$label.text = $script:time2
})
function rectangle {
$brush = New-Object System.Drawing.SolidBrush ([System.Drawing.Color]::FromArgb(6, 176, 37))
$groupboxGraphics.FillRectangle($brush, 5, 10, 365, 20)
}
$button.add_Click(
{
$Script:time1 = Get-Date
$timer.start()
$ProgressBar1.BringToFront()
$ProgressBar1.Show()
$this.Enabled = $false
$job = Start-Job -ScriptBlock {
Get-ChildItem -File -recurse "Z:\Merck_Peleton" -ErrorAction SilentlyContinue
}
while($job.State -eq 'Running') {
[System.Windows.Forms.Application]::DoEvents()
}
$job|Wait-job|Receive-Job|Set-Variable -Name PORNO -Scope Script
$groupbox.Controls.Remove($ProgressBar1)
$this.Enabled = $true
$timer.stop()
$label3.Text = [char]8730
$groupbox.Refresh()
rectangle
$label4.Show()
}
)
$label5 = New-Object system.windows.forms.label
$label5.Location = New-Object System.Drawing.Point(9, 35)
$label5.Size = New-Object System.Drawing.Size(365, 20)
$label5.TextAlign = 'middlecenter'
$label5.Text = 'COMPLETED!!!'
$label5.Visible = $false
$label5.BackColor = [System.Drawing.Color]::FromArgb(6, 176, 37)
$window.Controls.Add($label5)
$button2 = New-Object System.Windows.Forms.Button
$button2.Height = 50
$button2.Width = ($window.Width * 0.85)
$button2.Location = New-Object System.Drawing.Point (20, 350)
$button2.TextAlign = 'middlecenter'
$button2.Text = 'Exit'
$window.Controls.Add($button2)
$ProgressBar2 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar2.Location = New-Object System.Drawing.Point(8, 35)
$ProgressBar2.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar2.Style = "Marquee"
$ProgressBar2.MarqueeAnimationSpeed = 20
$ProgressBar2.UseWaitCursor = $true
$ProgressBar2.Visible = $false
$button2.add_Click({$window.Close()})
$button3 = new-object System.Windows.Forms.Button
$button3.Size = New-Object System.Drawing.Size (100, 50)
$button3.Location = New-Object System.Drawing.Point (20, 150)
$button3.Text = "Hashes"
$window.Controls.Add($button3)
$timer2 = New-Object System.Windows.Forms.Timer
$timer2.Interval = 1000
$timer2.add_Tick({$script:time4 =((get-date)-$script:time3).ToString("hh\:mm\:ss")
$label2.text = $script:time4
})
$button3.add_Click({
$Script:time3 = Get-Date
$timer2.start()
$ProgressBar2.BringToFront()
$ProgressBar2.Show()
$this.Enabled = $false
$job2 = start-job -scriptblock {
$using:PORNO|Get-FileHash -Algorithm MD5
}
while($job2.State -eq 'Running') {
[System.Windows.Forms.Application]::DoEvents()
}
$job2|Wait-job|Receive-Job|Set-Variable -Name DUSZNO -Scope Script
$ProgressBar2.Hide()
$groupbox.Controls.Remove($ProgressBar2)
$groupbox.Refresh()
$label5.show()
$this.Enabled = $true
$timer2.stop()
$label6.Text = [char]8730
})
$label2 = New-Object System.Windows.Forms.Label
$label2.size = New-Object System.Drawing.Size (100, 50)
$label2.Location = New-Object System.Drawing.Point (135, 150)
$label2.BorderStyle = 'Fixed3D'
$label2.ForeColor = 'green'
$label2.TextAlign = 'middlecenter'
$window.Controls.Add($label2)
$label6 = new-object System.Windows.Forms.Label
$label6.Size = New-Object System.Drawing.Size (100, 50)
$label6.Location = New-Object System.Drawing.Point (250, 150)
$label6.ForeColor = 'green'
$label6.TextAlign = 'middlecenter'
$label6.Font = $check_font
$label6.BorderStyle = 'Fixed3D'
$window.Controls.Add($label6)
$button4 = New-Object System.Windows.Forms.Button
$button4.size = New-Object System.Drawing.Size (100, 50)
$button4.Location = New-Object System.Drawing.Point (20, 210)
$button4.Text = "Extensions"
$window.Controls.Add($button4)
$timer3 = New-Object System.Windows.Forms.Timer
$timer3.Interval = 1000
$timer3.add_Tick({$script:time6 =((get-date)-$script:time5).ToString("hh\:mm\:ss")
$label7.text = $script:time6
})
$button4.Add_Click({
$Script:time5 = Get-Date
$timer3.start()
$job3 = start-job -scriptblock {
$using:PORNO|
Select @{l="Algorithm";e={}}, @{l="Hash";e={}}, @{l='File';e={$_.PSChildName}}, @{l='Compare Filename';e={$_.BaseName.replace('_','*').replace(' ','*').replace('-','*')}}, @{l="Path";e={$path $_.PSParentPath.Substring(38,$_.PSParentPath.Length-38)}}, @{l="Link";e={$_.FullName}}, @{l="Extension";e={$_.Extension}}|
group -Property 'Compare Filename'|
Where {@($_.Group.Extension |Sort -Unique).Count -ge 2}
}
while($job3.State -eq 'Running') {
[System.Windows.Forms.Application]::DoEvents()
}
$job3|Wait-job|Receive-Job|Set-Variable -Name CIASNO -Scope Script
$timer3.Stop()
$label8.Text = [char]8730
})
$label7 = New-Object System.Windows.Forms.Label
$label7.Size = New-Object System.Drawing.Size (100, 50)
$label7.Location = New-Object System.Drawing.Point (135, 210)
$label7.BorderStyle = 'Fixed3D'
$label7.ForeColor = 'green'
$label7.TextAlign = 'middlecenter'
$window.Controls.Add($label7)
$label8 = New-Object System.Windows.Forms.Label
$label8.Size = New-Object System.Drawing.Size (100, 50)
$label8.Location = New-Object System.Drawing.Point (250, 210)
$label8.BorderStyle = 'Fixed3D'
$label8.ForeColor = 'green'
$label8.Font = $check_font
$label8.TextAlign = 'middlecenter'
$window.Controls.Add($label8)
$timer4 = new-object System.Windows.Forms.Timer
$timer4.add_Tick({$script:time8 =((get-date)-$script:time7).ToString("hh\:mm\:ss")
$label9.text = $script:time8
})
$button5 = New-Object System.Windows.Forms.Button
$button5.size = New-Object System.Drawing.Size (100, 50)
$button5.Location = New-Object System.Drawing.Point (20, 270)
$button5.Text = "Zero Length"
$window.Controls.Add($button5)
$button5.Add_Click({
$Script:time7 = Get-Date
$timer4.start()
$job4 = start-job -scriptblock {
$using:PORNO|
? {$_.Length -eq 0}|
Select @{l='File';e={$_.PSChildName}}, Length, Directory, FullName
}
while($job4.State -eq 'Running') {
[System.Windows.Forms.Application]::DoEvents()
}
$job4|Wait-job|Receive-Job|Set-Variable -Name PRZYJEMNIE -Scope Script
$timer4.Stop()
if ($PRZYJEMNIE -eq $null){$label10.Text = "EMPTY"}else{$label10.Text = [char]8730}
})
$label9 = New-Object System.Windows.Forms.Label
$label9.Size = New-Object System.Drawing.Size (100, 50)
$label9.Location = New-Object System.Drawing.Point (135, 270)
$label9.BorderStyle = 'Fixed3D'
$label9.ForeColor = 'green'
$label9.TextAlign = 'middlecenter'
$window.Controls.Add($label9)
$label10 = New-Object System.Windows.Forms.Label
$label10.Size = New-Object System.Drawing.Size (100,50)
$label10.Location = New-Object System.Drawing.Point (250, 270)
$label10.BorderStyle = 'Fixed3D'
$label10.ForeColor = 'green'
$label10.Font = $check_font
$label10.TextAlign = 'middlecenter'
$window.Controls.Add($label10)
$groupbox = New-Object System.Windows.Forms.GroupBox
$groupbox.size = New-Object system.drawing.size @(377, 413)
$groupbox.Location = New-Object System.Drawing.point (4, -5)
$groupboxGraphics = $groupbox.CreateGraphics()
$groupbox.Controls.Add($ProgressBar1)
$groupbox.Controls.Add($ProgressBar2)
$window.Controls.Add($groupbox)
$window.ShowDialog()|out-null
CodePudding user response:
For anyone interested on how I solved this. Since I could not succesfully call two functions at the same time and nested jobs did not work out for me I turned to other solution. Timer
since the tick interval can be controlled and on every tick a scriptblock
or function
can be executed I created additional two timers (will clean up and optimise later) that chceck .status
of jobs I wanted to be run in background. Upon fining .state
to be finished they execute functions that previously were later parts of initial button script. I need to work on progressbars locations relative to 'completed' labels since they don't match-up exactly. But for the most part I achieved what I wanted.
UPDATED CODE
Add-Type -AssemblyName System.Windows.Forms
add-type -AssemblyName system.drawing
[System.Windows.Forms.Application]::EnableVisualStyles()
Function TEST_1
{
$Script:time1 = Get-Date
$timer.start()
$ProgressBar1.BringToFront()
$ProgressBar1.Show()
$this.Enabled = $false
$job = Start-Job -ScriptBlock {
Get-ChildItem -File -recurse $env:HOMEPATH -ErrorAction SilentlyContinue
}
while($job.State -eq 'Running') {
[System.Windows.Forms.Application]::DoEvents()
}
$job|Wait-job|Receive-Job|Set-Variable -Name PORNO -Scope Script
$groupbox.Controls.Remove($ProgressBar1)
$this.Enabled = $true
$timer.stop()
$label3.Text = [char]8730
$groupbox.Refresh()
$label4.Show()
}
$window = New-Object system.Windows.Forms.Form
$window.Height = 500
$window.Width = 400
$window.StartPosition = "CenterScreen"
$window.Font = New-Object System.Drawing.Font("Calibri",11,[System.Drawing.FontStyle]::Bold )
$window.Text = "Duplicates 2.0"
$location = New-Object System.Drawing.Point(10, 10)
$size = New-Object System.Drawing.Size(365, 20)
$ProgressBar1 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar1.Location = New-Object System.Drawing.Point(7, 10)
$ProgressBar1.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar1.Style = "Marquee"
$ProgressBar1.MarqueeAnimationSpeed = 20
$ProgressBar1.UseWaitCursor = $true
$ProgressBar1.Visible = $false
$ProgressBar2 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar2.Location = New-Object System.Drawing.Point(7, 35)
$ProgressBar2.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar2.Style = "Marquee"
$ProgressBar2.MarqueeAnimationSpeed = 20
$ProgressBar2.UseWaitCursor = $true
$ProgressBar2.Visible = $false
$ProgressBar3 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar3.Location = New-Object System.Drawing.Point(7, 60)
$ProgressBar3.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar3.Style = "Marquee"
$ProgressBar3.MarqueeAnimationSpeed = 20
$ProgressBar3.UseWaitCursor = $true
$ProgressBar3.Visible = $false
$ProgressBar4 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar4.Location = New-Object System.Drawing.Point(7, 85)
$ProgressBar4.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar4.Style = "Marquee"
$ProgressBar4.MarqueeAnimationSpeed = 20
$ProgressBar4.UseWaitCursor = $true
$ProgressBar4.Visible = $false
$button = New-Object System.Windows.Forms.Button
$button.size = New-Object system.drawing.size @(100,50)
$button.Location = New-Object System.Drawing.Point(20, 140)
$button.TextAlign = 'middlecenter'
$button.Text = "Gather `r`n Files"
$window.Controls.add($button)
$label = New-Object System.Windows.Forms.Label
$label.Size = New-Object System.Drawing.Size @(100, 50)
$label.Location = New-Object System.Drawing.Point (135, 140)
$label.BorderStyle = 'Fixed3D'
$label.ForeColor = 'green'
$label.TextAlign = 'middlecenter'
$window.Controls.Add($label)
$check_font = New-Object System.Drawing.Font ("Calibri",20,[System.Drawing.FontStyle]::Bold)
$label3 = New-Object system.windows.forms.label
$label3.Size = New-Object System.Drawing.Size (100, 50)
$label3.Location = New-Object system.drawing.point (250 ,140)
$label3.BorderStyle = 'Fixed3D'
$label3.ForeColor = 'green'
$label3.TextAlign = 'middlecenter'
$label3.Font = $check_font
$window.Controls.Add($label3)
$label4 = New-Object system.windows.forms.label
$label4.Location = New-Object System.Drawing.Point(7, 10)
$label4.Size = New-Object System.Drawing.Size(365, 20)
$label4.TextAlign = 'middlecenter'
$label4.Text = 'COMPLETED!!!'
$label4.Visible = $false
$label4.BackColor = [System.Drawing.Color]::FromArgb(6, 176, 37)
$window.Controls.Add($label4)
$label5 = New-Object system.windows.forms.label
$label5.Location = New-Object System.Drawing.Point(7, 35)
$label5.Size = New-Object System.Drawing.Size(365, 20)
$label5.TextAlign = 'middlecenter'
$label5.Text = 'COMPLETED!!!'
$label5.Visible = $false
$label5.BackColor = [System.Drawing.Color]::FromArgb(6, 176, 37)
$window.Controls.Add($label5)
$label11 = New-Object system.windows.forms.label
$label11.Location = New-Object System.Drawing.Point(7, 60)
$label11.Size = New-Object System.Drawing.Size(365, 20)
$label11.TextAlign = 'middlecenter'
$label11.Text = 'COMPLETED!!!'
$label11.Visible = $false
$label11.BackColor = [System.Drawing.Color]::FromArgb(6, 176, 37)
$window.Controls.Add($label11)
$label12 = New-Object system.windows.forms.label
$label12.Location = New-Object System.Drawing.Point(7, 85)
$label12.Size = New-Object System.Drawing.Size(365, 20)
$label12.TextAlign = 'middlecenter'
$label12.Text = 'COMPLETED!!!'
$label12.Visible = $false
$label12.BackColor = [System.Drawing.Color]::FromArgb(6, 176, 37)
$window.Controls.Add($label12)
$timer = New-Object System.Windows.Forms.Timer
$timer.Interval = 1000
$timer.add_Tick({$script:time2 =((get-date)-$script:time1).ToString("hh\:mm\:ss")
$label.text = $script:time2
})
$button.add_Click({TEST_1})
$button2 = New-Object System.Windows.Forms.Button
$button2.Height = 50
$button2.Width = ($window.Width * 0.85)
$button2.Location = New-Object System.Drawing.Point (20, 400)
$button2.TextAlign = 'middlecenter'
$button2.Text = 'Exit'
$window.Controls.Add($button2)
)
$button2.add_Click({$window.Close()})
$button3 = new-object System.Windows.Forms.Button
$button3.Size = New-Object System.Drawing.Size (100, 50)
$button3.Location = New-Object System.Drawing.Point (20, 200)
$button3.Text = "Hashes"
$window.Controls.Add($button3)
$timer2 = New-Object System.Windows.Forms.Timer
$timer2.Interval = 1000
$timer2.add_Tick({$script:time4 =((get-date)-$script:time3).ToString("hh\:mm\:ss")
$label2.text = $script:time4
})
function W_pizdeczke
{
write-host "W PIZDE!"
}
function W_deseczke2
{
$ProgressBar3.Hide()
$groupbox.Controls.Remove($ProgressBar3)
$groupbox.Refresh()
$label5.show()
$button4.Enabled = $true
$timer3.stop()
$button4_timer.stop()
$label8.Text = "Misiu"
}
function W_deseczke
{
$ProgressBar2.Hide()
$groupbox.Controls.Remove($ProgressBar2)
$groupbox.Refresh()
$label5.show()
$button3.Enabled = $true
$timer2.stop()
$button3_timer.stop()
$label6.Text = "Udało się"
}
$button3_timer = new-object system.windows.forms.timer
$button3_timer.Interval = 1000
$button3_timer.add_Tick({
$ticker = (get-job -name TESTOWA).state
$ticker|Out-Host
if ($ticker -eq 'Completed'){W_deseczke}
})
$button4_timer = new-object system.windows.forms.timer
$button4_timer.Interval = 1000
$button4_timer.add_Tick({
$ticker2 = (get-job -name TESTOWA2).state
$ticker2|Out-Host
if ($ticker2 -eq 'Completed'){W_deseczke2}
})
$button3.add_Click({
$button3_timer.Start()
$button4_timer.Start()
$Script:time3 = Get-Date
$Script:time5 = Get-Date
$timer2.start()
$timer3.start()
$ProgressBar2.BringToFront()
$ProgressBar2.Show()
$ProgressBar3.BringToFront()
$ProgressBar3.Show()
$this.Enabled = $false
$button4.enabled= $false
$job2 = start-job -Name "TESTOWA" -scriptblock {
$using:PORNO|
Get-FileHash -Algorithm MD5
}
$job3 = start-job -Name "TESTOWA2" -scriptblock {
$using:PORNO|
Select @{l="Algorithm";e={}}, @{l="Hash";e={}}, @{l='File';e={$_.PSChildName}}, @{l='Compare Filename';e={$_.BaseName.replace('_','*').replace(' ','*').replace('-','*')}}, @{l="Path";e={$path $_.PSParentPath.Substring(38,$_.PSParentPath.Length-38)}}, @{l="Link";e={$_.FullName}}, @{l="Extension";e={$_.Extension}}|
group -Property 'Compare Filename'|
Where {@($_.Group.Extension |Sort -Unique).Count -ge 2}
}
while(($job2.State -eq 'Running') -or ($job3.state -eq 'Running')) {
[System.Windows.Forms.Application]::DoEvents()
}
$job2|Wait-job|Receive-Job|Set-Variable -Name DUSZNO -Scope Script
$job3|Wait-job|Receive-Job|Set-Variable -Name CIASNO -Scope Script
})
$label2 = New-Object System.Windows.Forms.Label
$label2.size = New-Object System.Drawing.Size (100, 50)
$label2.Location = New-Object System.Drawing.Point (135, 200)
$label2.BorderStyle = 'Fixed3D'
$label2.ForeColor = 'green'
$label2.TextAlign = 'middlecenter'
$window.Controls.Add($label2)
$label6 = new-object System.Windows.Forms.Label
$label6.Size = New-Object System.Drawing.Size (100, 50)
$label6.Location = New-Object System.Drawing.Point (250, 200)
$label6.ForeColor = 'green'
$label6.TextAlign = 'middlecenter'
$label6.Font = $check_font
$label6.BorderStyle = 'Fixed3D'
$window.Controls.Add($label6)
$button4 = New-Object System.Windows.Forms.Button
$button4.size = New-Object System.Drawing.Size (100, 50)
$button4.Location = New-Object System.Drawing.Point (20, 260)
$button4.Text = "Extensions"
$window.Controls.Add($button4)
$timer3 = New-Object System.Windows.Forms.Timer
$timer3.Interval = 1000
$timer3.add_Tick({$script:time6 =((get-date)-$script:time5).ToString("hh\:mm\:ss")
$label7.text = $script:time6
})
$button4.Add_Click({
})
$label7 = New-Object System.Windows.Forms.Label
$label7.Size = New-Object System.Drawing.Size (100, 50)
$label7.Location = New-Object System.Drawing.Point (135, 260)
$label7.BorderStyle = 'Fixed3D'
$label7.ForeColor = 'green'
$label7.TextAlign = 'middlecenter'
$window.Controls.Add($label7)
$label8 = New-Object System.Windows.Forms.Label
$label8.Size = New-Object System.Drawing.Size (100, 50)
$label8.Location = New-Object System.Drawing.Point (250, 260)
$label8.BorderStyle = 'Fixed3D'
$label8.ForeColor = 'green'
$label8.Font = $check_font
$label8.TextAlign = 'middlecenter'
$window.Controls.Add($label8)
$timer4 = new-object System.Windows.Forms.Timer
$timer4.add_Tick({$script:time8 =((get-date)-$script:time7).ToString("hh\:mm\:ss")
$label9.text = $script:time8
})
$button5 = New-Object System.Windows.Forms.Button
$button5.size = New-Object System.Drawing.Size (100, 50)
$button5.Location = New-Object System.Drawing.Point (20, 320)
$button5.Text = "Zero Length"
$window.Controls.Add($button5)
$button5.Add_Click({
$Script:time7 = Get-Date
$timer4.start()
$job4 = start-job -scriptblock {
$using:PORNO|
? {$_.Length -eq 0}|
Select @{l='File';e={$_.PSChildName}}, Length, Directory, FullName
}
while($job4.State -eq 'Running') {
[System.Windows.Forms.Application]::DoEvents()
}
$job4|Wait-job|Receive-Job|Set-Variable -Name PRZYJEMNIE -Scope Script
$timer4.Stop()
if ($PRZYJEMNIE -eq $null){$label10.Text = "EMPTY"}else{$label10.Text = [char]8730}
})
$label9 = New-Object System.Windows.Forms.Label
$label9.Size = New-Object System.Drawing.Size (100, 50)
$label9.Location = New-Object System.Drawing.Point (135, 320)
$label9.BorderStyle = 'Fixed3D'
$label9.ForeColor = 'green'
$label9.TextAlign = 'middlecenter'
$window.Controls.Add($label9)
$label10 = New-Object System.Windows.Forms.Label
$label10.Size = New-Object System.Drawing.Size (100,50)
$label10.Location = New-Object System.Drawing.Point (250, 320)
$label10.BorderStyle = 'Fixed3D'
$label10.ForeColor = 'green'
$label10.Font = $check_font
$label10.TextAlign = 'middlecenter'
$window.Controls.Add($label10)
$groupbox = New-Object System.Windows.Forms.GroupBox
$groupbox.size = New-Object system.drawing.size @(377, 413)
$groupbox.Location = New-Object System.Drawing.point (4, -5)
$groupboxGraphics = $groupbox.CreateGraphics()
$groupbox.Controls.Add($ProgressBar1)
$groupbox.Controls.Add($ProgressBar2)
$groupbox.Controls.Add($ProgressBar3)
$groupbox.Controls.Add($ProgressBar4)
$window.Controls.Add($groupbox)
$window.ShowDialog()|out-null