Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ExcuseArray = New-Object System.Collections.ArrayList
- $url = "https://gist.githubusercontent.com/Chromulent/eb05e076a5ce097e1e15184f5688856e/raw/675f20603fb3cf44475c437e311ec2fbde7bf4fb/Ballard-Excuses.txt"
- $ExcuseContent = (Invoke-WebRequest -Uri $url).Content
- $ExcuseCollection = $ExcuseContent.Split([System.Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries)
- $ExcuseCollection | ForEach { $ExcuseArray.Add("$_") > $null }
- $ExcuseTotal = $ExcuseArray.Count
- $Tab = [char]9
- Add-Type -AssemblyName System.Speech
- $speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
- $speak.SelectVoice('Microsoft David Desktop')
- $v = 0;
- if ($v -ge 0 ){
- $rNum = Get-Random -Minimum 2 -Maximum $ExcuseTotal
- Clear-Host
- $Excuse = $ExcuseArray[$rNum]
- Write-Host("Excuse: " + $Tab + $Excuse ) -ForegroundColor Yellow
- $speak.Speak("$Excuse")
- Start-Sleep -Seconds 15
- }
- $snickers = $True ; Do {
- $Cont = Read-Host -Prompt "Do you want another excuse: ? [Y/N]"
- switch ($Cont) {
- {($_ -eq "y") -or ($_ -eq "yes") -or ($_ -eq "Y") -or ($_ -eq "Yes")} {
- $v++;
- $rNum = Get-Random -Minimum 2 -Maximum $ExcuseTotal
- Clear-Host
- $Excuse = $ExcuseArray[$rNum]
- Write-Host("Excuse: " + $Tab + $Excuse ) -ForegroundColor Yellow
- $speak.Speak("$Excuse")
- Start-Sleep -Seconds 15
- Clear-Host ; break}
- {($_ -eq "n") -or ($_ -eq "N") -or ($_ -eq "no") -or ($_ -eq "No")} { $snickers = $False; break}
- default {break}
- }
- }
- Until ($snickers -eq $False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement