I recently found out about iCAR, which is an open-source project to add auto-reply abilities to iChat. You can use this to do any number of things -- respond with a static 'away' message, make a 'chatbot' that talks like Eliza the therapist, or control iTunes, an EyeTV, X10 devices if you have those.
I realized that I could use this to create an instant audio or video "room monitor," allowing me to quickly check on things at home. iCAR can't yet auto-accept your invitation to an AV chat, so instead, we'll have the listening Mac invite you to an AV chat when you ask it to.
To do this, you'll need:To make your 'iChat room monitor,' do this:
That's it! The script is just a stub -- feel free to post other ideas in the comments.
Script:
#!/usr/bin/perl
###############################################
# Settings
###############################################
# Setup
$screen_name = $ENV{'iCAR_screenname'};
$real_name = $ENV{'iCAR_name'};
$received_message = $ENV{'iCAR_message'};
$time_of_day = get_time_of_day();
## debugging:
#$screen_name = "myhandle";
#$received_message = "listen";
###############################################
# Main response
if ($received_message =~ /listen/)
{
start_media_chat($screen_name,"audio");
}
elsif ($received_message =~ /watch/)
{
start_media_chat($screen_name,"video");
}
else
{
# joe public
print "Good $time_of_day, $real_name.";
}
exit;
###############################################
# subroutines
sub start_media_chat($$)
{
my ($screen_name_to_invite,$media_type) = @_;
print "Starting $media_type chat...\r\n";
close STDOUT;
my $script = media_chat_script($screen_name_to_invite,$media_type);
system("osascript -e '" . $script . "' &");
}
sub media_chat_script($$)
{
my ($screen_name_to_invite,$media_type) = @_;
return <<EOS;
tell application "iChat"
repeat with a in (every account where handle is "$screen_name_to_invite")
send $media_type invitation to a
end repeat
end tell
EOS
}
sub get_time_of_day()
{
my ($sec,$min,$hour) = localtime(time);
if ($hour < 12)
{
return 'morning';
}
elsif ($hour < 6)
{
return 'afternoon';
}
else
{
return 'evening';
}
}
Mac OS X Hints
http://hints.macworld.com/article.php?story=20031007091516669