Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # YellowOnline's entry for OMGWTF
- #
- # Instructions:
- # Save as OMG-WTF.ps1 (or any other name) and run with PowerShell. Make sure to set the script execution policy right first.
- # Comments:
- # 1) Everything you dislike is on purpose ^^
- # 2) Most flexers can't properly highlight this code because of an annoying variable.
- # Congrats to Pastebin who also have trouble with it, but only for that line :)
- # 3) In a scripting language like PoSh it is hard to compete with a real programming language when it comes to writing bad code. Injecting, say, C# or VB.NET, would be a bit cheating.
- #
- Function Randomize-Output($Input){$myResult = Get-Random -Minimum $([decimal]$($AllPossibilitys[0]."0")) -Maximum $($([decimal]$($($AllPossibilitys[1]."1")))+1);Return $([math]::truncate($myResult));}
- Function Calculate-TheThing()
- {
- [int]$Zero="0"
- [int]$One="1"
- If($Zero -EQ 0){$One="1"}
- ElseIf ($One -EQ 1){$Zero="0"} Else{$One="1";$Zero="0"}
- $Array = @($Zero,$One)
- $TextInfo = [System.Threading.Thread]::CurrentThread.CurrentCulture.TextInfo
- $AllPossibilitys=@()
- ForEach ($Object in $Array) {$NewObject = New-Object System.Object;$NewObject|Add-Member -MemberType Noteproperty -Name "$Object" -Value "$Object";$AllPossibilitys += $NewObject}
- ${²&|é@"#'(§^è!!ç`{à`})°}=Randomize-Output $Null
- Switch (${²&|é@"#'(§^è!!ç`{à`})°}){0{$a = $TextInfo.ToTitleCase($("YES").ToLower())};1{$a = $TextInfo.ToTitleCase($("NO").ToLower())}}
- Return $a;
- }
- [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
- [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
- $Form = New-Object System.Windows.Forms.Form
- $Form.Text = "TDWTF Management"
- $Form.Size = New-Object System.Drawing.Size(300,200)
- $Form.StartPosition = "CenterScreen"
- $Form.KeyPreview = $True
- $Form.Add_KeyDown({if ($_.KeyCode -eq "Enter"){$Form.Close()}})
- $Form.Add_KeyDown({if ($_.KeyCode -eq "Escape"){$Form.Close()}})
- $OutputBox = New-Object System.Windows.Forms.Label
- $OutputBox.Location = New-Object System.Drawing.Size(25,40)
- $OutputBox.Size = New-Object System.Drawing.Size(110,20)
- $OutputBox.Text = ""
- $Form.Controls.Add($OutputBox)
- $GenerateButton = New-Object System.Windows.Forms.Button
- $GenerateButton.Location = New-Object System.Drawing.Size(25,120)
- $GenerateButton.Size = New-Object System.Drawing.Size(75,23)
- $GenerateButton.Text = "Generate"
- $GenerateButton.Add_Click({
- $12 = Calculate-TheThing
- $OutputBox.Text = "Our advice is: `"$12`""
- })
- $Form.Controls.Add($GenerateButton)
- $OKButton = New-Object System.Windows.Forms.Button
- $OKButton.Location = New-Object System.Drawing.Size(100,120)
- $OKButton.Size = New-Object System.Drawing.Size(75,23)
- $OKButton.Text = "OK"
- $OKButton.Add_Click({$Form.Close()})
- $Form.Controls.Add($OKButton)
- $CancelButton = New-Object System.Windows.Forms.Button
- $CancelButton.Location = New-Object System.Drawing.Size(175,120)
- $CancelButton.Size = New-Object System.Drawing.Size(75,23)
- $CancelButton.Text = "Cancel"
- $CancelButton.Add_Click({$Form.Close()})
- $Form.Controls.Add($CancelButton)
- $Form.Controls.Add($objLabel)
- $ListBox = New-Object System.Windows.Forms.ListBox
- $ListBox.Location = New-Object System.Drawing.Size(10,40)
- $ListBox.Size = New-Object System.Drawing.Size(260,20)
- $ListBox.Height = 80
- $Form.Topmost = $True
- $Form.Add_Shown({$Form.Activate()})
- [void] $Form.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment