• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Make your PowerShell blurt out random sayings

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

notarat

Member
Joined
Nov 11, 2010
So I was playing around in Power Shell the other day when I came across a script to make Power Shell speak. I decided to play with it a bit and came up with a way for it to speak random lines out of a text file.

I can't run .ps1 files at work so I put the script into a VB Wrapper (because we can run VB Script) and I scheduled it to run about every 20 minutes or so.

Here's the code:

Code:
$speak=(Get-Random -InputObject (get-content C:\inputfiles\random.txt))
Add-Type -AssemblyName System.Speech 
$synth = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
$synth.Speak($speak)
 
This is what I have in my Random.txt file. it's just some random list I found online of funny sayings.

Daddy listens to too much K Pop. He needs help.
When your only tool is a hammer, all problems start looking like nails.
ninety nine percent of lawyers give the rest a bad name.
Artificial intelligence is no match for natural stupidity.
The last thing I want to do is insult you. But it IS on the list.
I don't have a solution, but I do admire the problem.
The only substitute for good manners is fast reflexes.
Support bacteria. They're the only culture some people have.
Letting the cat out of the bag is a whole lot easier than putting it back in.
Well, here I am! What are your other two wishes?
Time doesn't exist. Clocks exists.
My mind’s made up, don’t confuse me with facts.
Talk is cheap. Until you hire a lawyer.
Take my advice. I'm not using it.
I got lost in thoughts because it was unfamiliar territory.
Sure, I'd love to help you out. Which way did you come in?
Your touch is so cold, daddy. Don't you love me anymore.
I would like to slip into something more comfortable, like a coma.
I started with nothing, and I still have most of it.
Ever stop to think, and forget to start again?
There is no dance without the dancers.
Out of my mind. Back in five minutes.
The problem with trouble shooting is that trouble shoots back.
If you are here, Who is running hell?
If nothing was learned, nothing was taught.
Very funny, Scotty. Now beam down my clothes.
Treat each day as your last; one day you will be right.
Red meat is not bad for you. Fuzzy green meat is bad for you.
The early bird may get the worm, but the second mouse gets the cheese.
It's scary that doctors call what they do, practice.
The problem with sex in the movies is, that the popcorn usually spills.
If I want your opinion, I'll ask you to fill out the necessary forms.
Living on Earth is expensive, but it does include a free trip around the sun.
Despite the cost of living, have you noticed how popular it remains?
All power corrupts. Absolute power is pretty neat, though.
Always remember you're unique, just like everyone else.
Everybody repeat after me. We are all individuals.
Confession is good for the soul, but bad for your career.
A bartender is just a pharmacist with a limited inventory.
I want patience, AND I WANT IT NOW!
It's a fine day for firm decisions. Or is it.
Am I ambivalent? Well, yes and no.
Bombs don't kill people, explosions kill people.
Bureaucrats cut red tape, lengthwise.
Help stamp out, eliminate, and abolish, redundancy!
How many of you believe in telekinesis? Raise MY hand!
A dog has an owner. A cat has a staff.
Every organisation is perfectly designed to get the results they are getting.
 
Back