Slash Boxes
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 ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Wednesday April 23, 2003
06:58 AM


[ #11800 ]

iChatStatus is a cool little utility that can automate your iChat status message. It is primarily used, probably, to show what is playing in iTunes.

I took two of the scripts, one for iTunes and one for EyeTV, and combined them into one, looking first at EyeTV and then iTunes. This script is installed on my server box, which houses the EyeTV and iTunes players I normally use.

Then, I wrote a Perl script that first sees if iTunes is playing, and if not checks that script on the remote box, and if not, gets the current front application. It uses Mac::Glue for Mac OS X, which is not yet released, but will be someday ... :-)

Note that iChatStatus does not use Apple events to update iChat, as iChat is not scriptable. It uses the private iChat frameworks, which are subject to change.

use strict;
use warnings;
no warnings 'utf8';
use Mac::Apps::Launch;
use Mac::Glue ':all';
use Socket;
my $itunes = new Mac::Glue 'iTunes';
if (IsRunning($itunes->{ID})) {
    my $status = $itunes->get( $itunes->prop('player state') );
    if ($status eq 'playing') {
        my $track = $itunes->prop('current track');
        my %info;
        for my $prop (qw(name artist album)) {
            $info{$prop} = $itunes->get( $itunes->prop($prop => $track) );
        print "\x{266C} $info{name} - $info{artist}";
# only try this if i am at home
my $ip = inet_ntoa(inet_aton(""));
if ($ip eq '') {
    my $result = `ssh sweeney osascript ~/Library/Scripts/myscript.scpt`;
    if ($result =~ /\w/) {
        print $result;
my $system = new Mac::Glue 'System Events';
my $app = $system->prop(name => item => 1,
    application_process => whose(frontmost => equals => 1)
print "Using: ", $system->get($app);

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.