Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Thursday November 14, 2002
03:35 AM

Making my computer speak

[ #8943 ]

Sometimes computers figure out your weaknesses and then use them to distract you from real work. Once you think that you beat them you waste time telling people about them. Its a virus.

This virus speaks output from Perl programs. If I wanted to get really fancy I could create a Tie module to multiplex output to where it should go and speak it as well. Um, let's see if I can forget I thought that.

#!/usr/bin/perl
 
use Mac::AppleScript qw(RunAppleScript);
 
foreach ( reverse ( 'blast off!', 1 .. 10 ) )
    {
    print "$_\n";
 
    RunAppleScript( qq| say "$_" | );
    sleep 1;
    }