iChatStatus
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.
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.
#!/usr/bin/perl
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}";
exit;
}
}
# only try this if i am at home
my $ip = inet_ntoa(inet_aton("bourque.pudge.net"));
if ($ip eq '10.0.1.177') {
my $result = `ssh sweeney osascript ~/Library/Scripts/myscript.scpt`;
if ($result =~/\w/) {
print $result;
exit;
}
}
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);
__END__
Leave a comment