Guest User

Untitled

a guest
Nov 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. Add-Type -AssemblyName System.Windows.Forms
  2. [System.Windows.Forms.Application]::EnableVisualStyles()
  3.  
  4. $congs = @(
  5. "Congregation 1",
  6. "Congregation 2",
  7. "Congregation 3",
  8. "Congregation 4",
  9. "Congregation 5",
  10. "Congregation 6",
  11. "Congregation 7",
  12. "Congregation 8",
  13. "Others"
  14. )
  15.  
  16. $heigth = 55+ 55 * $congs.Length
  17.  
  18. $MainForm = New-Object system.Windows.Forms.Form
  19. $MainForm.ClientSize = "300,$heigth"
  20. $MainForm.Text = "OnlyR Congregation selection"
  21. $MainForm.MaximizeBox = $false
  22. #$MainForm.Icon = New-Object System.Drawing.Icon("C:\Icons\onlyr.ico")
  23. $MainForm.ShowInTaskbar = $false
  24.  
  25. $MainForm.BackColor = "#fefefe"
  26.  
  27. $verStart = {
  28. $vers = $this.Text
  29. Remove-Item -Path $env:APPDATA\OnlyR\$vers -Recurse -erroraction 'silentlycontinue'
  30. New-Item -ItemType "directory" -Path $env:APPDATA\OnlyR\$vers
  31. Copy-Item $env:APPDATA\OnlyR\1 -Destination $env:APPDATA\OnlyR\$vers\1 -Recurse -Force
  32. & "C:\Program Files (x86)\OnlyR\OnlyR.exe" /id=$vers /nosettings
  33. $MainForm.Close()
  34. }
  35.  
  36.  
  37. $Label1 = New-Object system.Windows.Forms.Label
  38. $Label1.text = "Please select a congregation"
  39. $Label1.BackColor = "#ffc107"
  40. $Label1.ForeColor = "#000000"
  41. $Label1.TextAlign = 32
  42. #$Label1.AutoSize = $true
  43. $Label1.width = 300
  44. $Label1.height = 55
  45. $Label1.location = New-Object System.Drawing.Point(0,00)
  46. $Label1.Font = 'Microsoft Sans Serif,14,style=Bold'
  47.  
  48. $btns = @($Label1)
  49.  
  50. for ($i=0; $i -lt $congs.length; $i++){
  51. $cong = $congs[$i]
  52. $offset = 55 + $i * 55
  53. $Button1 = New-Object system.Windows.Forms.Button
  54. $Button1.text = $cong
  55. $Button1.width = 300
  56. $Button1.height = 50
  57. $Button1.location = New-Object System.Drawing.Point(0,$offset)
  58. $Button1.Font = 'Microsoft Sans Serif,14'
  59. $Button1.Add_Click($verStart)
  60. $btns += $Button1
  61.  
  62. }
  63.  
  64. $MainForm.controls.AddRange($btns)
  65.  
  66. [void]$MainForm.ShowDialog()
Add Comment
Please, Sign In to add comment