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

Watch or listen to your remote Mac with iChat AV Apps

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:
  1. Two Macs, both running iChat AV. I'll call one the 'listening Mac', and the other 'your Mac.'
  2. One AIM/.Mac account for yourself, and a different one for the listening Mac. You can grab one at http://aim.com.
  3. The listening Mac can use its built-in microphone, or a microphone, webcam, or Firewire digicam.
[robg adds: I haven't tested this one out yet, but I intend to -- it seems very very useful!]

To make your 'iChat room monitor,' do this:
  1. Download iCAR on the listening Mac.
  2. Download this Perl script, or copy-and-paste from the end of this hint. Remember you need to make the script executable (chmod a+x /path/to/iChatGreet.pl) if you copy-paste.
  3. In iChat on the listening computer, add yourself to the buddy list. The script will only initiate an AV chat with someone on the listening computer's buddy list.
  4. Open iChat preferences, and under 'Auto-Reply', select the script as a Unix command source.
When you want to watch or listen to the listening Mac, just start a regular text chat with your listening Mac. If you type 'listen', it will invite you to an audio chat; if you type 'watch', it will invite you to a video chat.

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';
  }
}
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[20,490 views]  

Watch or listen to your remote Mac with iChat AV | 22 comments | Create New Account
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: livi on Oct 09, '03 03:13:55PM

looks very promising... however, can't get the perl-script to work.

The auto-reply works but the specified script for auto-answering with Audio/Video doesn't seems to work here.



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: livi on Oct 09, '03 04:25:41PM

The error must be in this part of the script :
----
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:

1. Two Macs, both running iChat AV. I'll call one the 'listening Mac', and the other 'your Mac.'
2. One AIM/.Mac account for yourself, and a different one for the listening Mac. You can grab one at http://aim.com.
3. The listening Mac can use its built-in microphone, or a microphone, webcam, or Firewire digicam.

[robg adds: I haven't tested this one out yet, but I intend to -- it seems very very useful!]
To make your 'iChat room monitor,' do this:

1. Download iCAR on the listening Mac.
2. Download this Perl script, or copy-and-paste from the end of this hint. Remember you need to make the script executable (chmod a+x /path/to/iChatGreet.pl) if you copy-paste.
3. In iChat on the listening computer, add yourself to the buddy list. The script will only initiate an AV chat with someone on the listening computer's buddy list.
4. Open iChat preferences, and under 'Auto-Reply', select the script as a Unix command source.
When you want to watch or listen to the listening Mac, just start a regular text chat with your listening Mac. If you type 'listen', it will invite you to an audio chat; if you type 'watch', it will invite you to a video chat.

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
}
----


If I try to run the script in terminal I see the following error :

maccie% ./ichatgreet.pl
Bareword found where operator expected at ./ichatgreet.pl line 58, near "EOS"
(Might be a runaway multi-line << string starting on line 50)
syntax error at ./ichatgreet.pl line 58, near "EOS"
Missing right curly or square bracket at ./ichatgreet.pl line 74, at end of line
syntax error at ./ichatgreet.pl line 74, at EOF
Execution of ./ichatgreet.pl aborted due to compilation errors.



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: nikitab on Oct 09, '03 05:26:31PM
You should fix the script so that the line that has 'EOS' just by itself (after 'end tell') has no white space in front of it. The indentation is causing the problems. I.e.:
   ...
     end repeat
   end tell
EOS
}


[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: livi on Oct 10, '03 07:17:06AM

Yep.... it works fine now !

This is a great application for monitoring your computer or room...



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: AaronS on Oct 12, '03 09:04:05PM

It didn't seem to fix the problem for me. All that happens after I choose the perl script and then IM the "listening" computer is a spit out of the computers uptime, which appears to be the original script that was entered...

Any other ideas?



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: dcottle on Oct 13, '03 01:11:04AM

I just stumbled onto this thread and it looks like something I could use. I record concerts in a music building and we have several venues. I've been thinking of linking them over ethernet. But is the sample and bit rate high enough? I imagine iChat is pretty low, or is it?



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: mithras on Oct 13, '03 03:54:57PM

Try typing the path to the script instead of using the "Select" button, or try selecting it and then quitting right away... iCAR seems to be finicky about this.

---
--
Listen To My iTunes Library (6500+ songs, iTunes 4 required)



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: maclaxguy on Oct 09, '03 04:55:09PM
To run it in the Terminal, try this: perl ichatgreet.pl

[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: stilesja on Oct 09, '03 04:49:40PM

You could do this with Darwin Streaming Server controlling Quicktime Broadcaster.

Setup a DynDns.org account so you don't need to know the ip address
Install Darwin Streaming Server & Quicktime Broadcaster
You can login to your managment console at http://yourhost.dyndns.org:1220/ and turn the Broadcast on

Then with any version of Quicktime on Anyplatform, open rtsp://yourhost.dyndns.org/mystream.sdp


The only problem is I can't get it to work through my NAT router, even with the mac setup as DMZ host... Not sure why. But it works great with the Mac plug directly into the DSL modem..



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: maclaxguy on Oct 09, '03 04:57:03PM

Do you have any hints on how to get this to work with the Eliza chatbox?

Thanks!



[ Reply to This | # ]
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 | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: imacusr on Oct 09, '03 10:40:32PM
Open iChat preferences, and under 'Auto-Reply', select the script as a Unix command source.

Where is this preference found in iChat? I didn't see it anywhere.

[ Reply to This | # ]

Watch or listen to your remote Mac with iChat AV
Authored by: sjmills on Oct 09, '03 11:12:14PM

Did you install iCAR? I'm guessing you didn't. You also need to quit and relaunch iChat in order for the pref panel to show up.



[ Reply to This | # ]
Next step : a motorized holder for iSight
Authored by: VRic on Oct 11, '03 12:59:50PM

A gadget genious should now build a remote controlled tilt/swivel holder for the camera.

I even have the ideal alibi to present to the management: that thing would be very useful for disabled persons who are common users of videoconferencing but can't adjust the thing manually.

Of course WE know it's a toy, but toys are too cheap to have a company fund such a gadget, whereas Assistive Technology is a very profitable market.



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: livi on Nov 09, '03 07:45:38AM

hmmm... this script worked fine in 10.2, but now with 10.3 it doesn't work anymore !

The 'good morning' autoreply is working, but the video or audio invitation doesn't startup anymore....

Who can help ?



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: tylerlin on Dec 18, '03 05:35:05AM

For OSX 10.3, I played around with the script and found that the contact id may be the problem. after adding a back slash before @ in the email address, the script will work. Since I don't know how to do perl, someone please produce a working code, Thank you.

for now, i hard coded the contact info to make it work.



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: tylerlin on Dec 18, '03 02:58:04PM

One strange thing to add...
the modified script works if i type "perl iChatGreet.pl" in terminal,
but still does not work in actual situation, anyone know why?



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: pilbery on Dec 29, '03 01:58:45PM

Try typing perl -w iChatGreet.pl
I suspect that you will find a number of exceptions even in your modified script?!
These are the complaints I get with the original script...

main::get_time_of_day() called too early to check prototype at iChatGreet.pl line 12.
main::start_media_chat() called too early to check prototype at iChatGreet.pl line 22.
main::start_media_chat() called too early to check prototype at iChatGreet.pl line 26.
Use of uninitialized value in pattern match (m//) at iChatGreet.pl line 20.
Use of uninitialized value in pattern match (m//) at iChatGreet.pl line 20.
Use of uninitialized value in concatenation (.) or string at iChatGreet.pl line 31.

Alas, it doesn't mean much to me.



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: Nounou on Dec 20, '03 11:25:00AM

Hello,

is it possible to explain where you modify the email adress?
I tried different things and it doesn't work for me...

Thx,

Nounou



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: livi on Sep 23, '04 09:14:37AM

I would love to see someone building a AIM/iChat bot with this application ... Could be used to get data out of a Filemaker Database depending on data the user enters (eg an order number) ....



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: jweill415 on Jan 20, '05 06:35:52PM

Does anyone have this perl script for ichat version 2.1? if not can anyone help me to update the script so it will work with the most recent ichat.

thanks



[ Reply to This | # ]
Watch or listen to your remote Mac with iChat AV
Authored by: livi on Mar 13, '05 10:05:47AM

Would also love to see an update on this script so it works with the latest iChat App.



[ Reply to This | # ]