Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Watch or listen to your remote Mac with iChat AV' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Watch or listen to your remote Mac with iChat AV
Authored by: pknull on Oct 14, '03 02:49:13AM

All you need to do is install the eliza package. Once that's done, modify the script as such.

#!/usr/bin/perl

###############################################
# Setup
srand( time ^ ($$ + ($$ << 15)) );
$screen_name = $ENV{'iCAR_screenname'};
$real_name = $ENV{'iCAR_name'};
$received_message = $ENV{'iCAR_message'};

####################################################
# ELIZA
use Chatbot::Eliza;
$myrobot = new Chatbot::Eliza "BotName", "/Path/to/doctor.txt";
$myrobot->debug( 1 );
$ELIZA = $myrobot->transform($received_message);

####################################################
# Main response
if ($received_message =~ /fudge/)
{
start_media_chat($screen_name,"audio");
}
elsif ($received_message =~ /fish/)
{
start_media_chat($screen_name,"video");
}
else
{
# joe public
print "$ELIZA";
}
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
}



[ Reply to This | # ]