[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Talking Process Watcher (a MacPerl 'daemon'?)



Yup, here it is!

#!perl -wl

# Speaks the currently running processes at 15 second intervals.
# Hides in the background.
# Prints to the MacPerl console when brought forward.
# Save it as a runtime application.
# Brian McNett <webmaster@mycoinfo.com>

use strict;
use Mac::Processes;
use Mac::Apps::Launch;
use Mac::Speech;

Hide('MacPerl', 1) or warn $^E;
my $channel = NewSpeechChannel($Voice{Victoria});

for (;;) {
my ( $year, $month, $day, $hour, $min, $sec) = reverse((localtime)[0 .. 
5]);
printf('%04d:%02d:%02d 
%02d:%02d:%02d',$year+1900,$month+1,$day,$hour,$min,$sec);
print "\n------------------------------\n";

foreach my $psi (values %Process) {
        printf("%s %s [%s bytes]\n",
        $psi->processSignature(),
        $psi->processName(),
        $psi->processSize()
        );
        my $process_name = $psi->processName(); # explicitly coerce 
"processName" to string!
        SpeakText($channel, "$process_name" );
             while (SpeechBusy()) {}
   }
print "\n------------------------------\n";

sleep(15);
}

DisposeSpeechChannel($channel);

__END__

Brian McNett, Webmaster
*************************************************************
Mycoinfo. The world's first mycology e-journal.
http://www.mycoinfo.com/
*************************************************************


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org