i am the funny
 

 I AM THE FUNNY!!!

This is a fairly simple GUI. You can use diffirent programs which will design the GUI for you and then spit out the code, but they usually add alot of unnecessary lines. Plus, where is the fun in that?

I am just letting it use the default voice in this. Some info on voices here.


<#
.
SYNOPSIS
GUI to say a random predefined phrase
.
DESCRIPTION
  
The GUI has a button which you press to enable to computer to say a phrase
Predefined phrases are in the TalkDirtyToMe function
#>

#Load Assemblies
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[
System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
[
Reflection.Assembly]::LoadWithPartialName('System.Speech') | Out-Null
$object = New-Object System.Speech.Synthesis.SpeechSynthesizer
$object.SelectVoiceByHints('Male')

# Function to set the volume
Function Set-Speaker($Volume){
$wshShell = new-object -com wscript.shell;1..50 | % {$wshShell.SendKeys([char]174)};1..$Volume | % {$wshShell.SendKeys([char]175)}
}

# Function to select and speak random phrase
Function TalkDirtyToMe{
$num = Get-Random -Maximum 11 -Minimum 1 #if changing the number of choices, remember that the maximum number needs to be 1 higher than the number of variables.
switch($num){
1{ $object.Speak("Oh yes! Just like that!") }
2{ $object.Speak("You know how to push my buttons") }
3{ $object.Speak("Touch it again") }
4{ $object.Speak("What's the difference between you and a mallard with a cold? One's a sick duck and ... I can't remember how it ends, but your mother's a whore.") }
5{ $object.Speak("Unless your name is google, stop acting like you know everything!") }
6{ $object.Speak("I licked it. So it is mine!") }
7{ $object.Speak("Meeeeeeeeh") }
8{ $object.Speak("Yes") }
9{ $object.Speak("No") }
10{ $object.Speak("I ........................... am potato") }
 }
}

#Function called by the button
Function YouTouchedMyButton{
#Sets volume to 80% (50 is 100%)
Set-Speaker -Volume 40
TalkDirtyToMe
}


#Draw form
$Form = New-Object System.Windows.Forms.Form
$Form.width = 264
$Form.height = 192
$Form.backcolor = [System.Drawing.Color]::Black
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::Fixed3D
$Form.Text = "I AM BUTTON"
$Form.Font = New-Object System.Drawing.Font("Verdana",10,[System.Drawing.FontStyle]::Bold)
$Form.maximumsize = New-Object System.Drawing.Size(264,192)
$Form.startposition = "centerscreen"
$Form.KeyPreview = $True
$Form.Add_KeyDown({if ($_.KeyCode -eq "Enter") {}})
$Form.Add_KeyDown({if ($_.KeyCode -eq "Escape")
 {
$Form.Close()}})

#Draw buttons
$Button1 = new-object System.Windows.Forms.Button
$Button1.Location = new-object System.Drawing.Size(83,38)
$Button1.Size = new-object System.Drawing.Size(80,74)
$Button1.Backcolor = "DarkRed"
$Button1.Text = "TOUCH ME"
$Button1.Add_MouseHover({$Button1.backcolor = [System.Drawing.Color]::Gray})
$Button1.Add_MouseLeave({$Button1.backcolor = [System.Drawing.Color]::DarkRed})
$Button1.Add_Click({YouTouchedMyButton})

#Add them to form and active it
$Form.Controls.Add($Button1)
$Form.Add_Shown({$Form.Activate()})
$Form.ShowDialog()