If this isn't a cool use for perl, then by god, I don't know what is. This script uses Microsoft's Speech API
http://www.microsoft.com/speech to say whatever you tell it to. I found this originally on Progressive Perl (don't have a link) and fooled around with it. It is by no means my own code. The speech, however, was created by myself and
primus.
use Win32::OLE qw( EVENTS );
my $DirectSS =
new Win32::OLE( "{EEE78591-FE22-11D0-8BEF-0060081841DE}" );
$DirectSS->Speak("Good evening, Mr. Anderson. How's your day been? G
+oooood. Well, listen, I'm going to have to ask you to be assimilated
+ into the Borg because, yeah, resistance is futile. Oh, and about th
+ose TPS reports. Yeah, didja get that memo? You see, we're putting
+new cover sheets on all our TPS reports. By the way, I've taken the
+liberty of searching, searching, searching out. your domain controlle
+rs. It seems they're named charles and michael. or should i say, we
+re? cuz now they're pete and repeat. yeah. how do you like that?
+by the way, if pete and repeat are in a boat and pete jumps out,
who's left? Ok, i'll say it again. if pete and repeat are in a boat
+and pete jumps out, who's left? that was a little borg humor for you
+. most people don't know about it, but we can be a regular barrel of
+ laughs when we want to. and remember: anything is possible, except
+skiing through a revolving door. Because then where would we be? no
+where, that's where. by the way, you're logged in as " . getlogin .
+". We Borg know that kind of stuff. It's what we do, so we have to
+be good at it. and we are. we're really good. really good. really
+, really good. in fact, so good that we know that everything about yo
+ur computer. everything. have a pleasant remainder of your day. ch
+eers from the borg.
");
while( $DirectSS->{Speaking} )
{
Win32::OLE->SpinMessageLoop();
Win32::Sleep( 100 );
}
This code runs on Windows 2000. It doesn't seem to work on my XP Pro box, but the docs say it's supposed to work on ME, XP Home, XP Pro, and 2000. Then again, maybe I shouldn't trust Microsoft documentation....
Anyways, if you're running 2000, give this a shot. And if you're running some other flavor of windows and you get it to work anyway, comment here so the rest of us can figure it out. :)
Some parts of this really have to be heard to appreciate. Listening to Sam (the primary M$oft voice) say "searching, searching, searching out. your domain controllers" is a whole lot better to hear than to read.
Update: The trick to using this on XP is to download the SAPI 4.0 from Microsoft's Speech site.
Here's a Tk program that will say whatever you tell it:
use Win32::OLE qw( EVENTS );
use Tk;
my $DirectSS = new Win32::OLE( "{EEE78591-FE22-11D0-8BEF-0060081841DE}
+" ) or die "$!";
$mw = MainWindow->new(-title => "the BATKINS speaker");
my $text = $mw->Text->pack;
$text->focus;
$mw->Button(-text => 'say it', -command => sub { say($text->get("0.0",
+ "end")); })->pack;
MainLoop;
sub say
{
my $say = shift;
$DirectSS->Speak($say);
while( $DirectSS->{Speaking} )
{
Win32::OLE->SpinMessageLoop();
Win32::Sleep( 100 );
}
}
For added fun, tell this program to say "he. a-he. a-he-he-he."