[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] AOLiza (MacPerl in the news!)



Hi--
Umm, this was done a couple months ago.
http://trisomy21.dhs.org/akira
It is a pure perl program. It uses Eliza (for now), and it is up under the
SN "AIMPerlBot". I can't believe this "AOLiza" got on CNN.
--Quentin
----- Original Message -----
From: "Chris Nandor" <pudge@pobox.com>
To: <macperl@macperl.org>
Sent: Friday, September 01, 2000 11:37 PM
Subject: [MacPerl] AOLiza (MacPerl in the news!)


> http://www.cnn.com/2000/TECH/computing/08/29/aoliza.idg/index.html
>
> http://fury.com/aoliza/
>
> First, the story: a guy wrote a bot using AOL Instant Messenger, some
AppleScripts, and Perl to respond to Instant Messenges with Eliza.  So I was
curious how he did it, and I wrote my own version, since he didn't (yet)
make the source available.
>
> He apparently did his with tailing the output of some log files.  I did my
original version that way and sent it to the list a few days ago.  Then I
figured out I could set AOL IM to execute an AppleScript every time a new IM
was received.  So I wrote a little AppleScript that says (where << and >>
are « and »):
>
> on <<event OscrNuIM>> theIM
> tell application "MacPerl" to <<event OscrNuIM>> theIM
> end <<event OscrNuIM>>
>
> Then I have my bot running in MacPerl, waiting for incoming IMs.  At first
I used the standard %AppleEvent hash:
>
>     $AppleEvent{'Oscr', 'NuIM'} = \&handler;
>
> The problem was that I would then have to take the incoming Apple event
descriptor record and pull out the items and I just didn't want to bother.
So I added handle_event() to Mac::AppleEvents::Simple, which looks similar:
>
>     handle_event('Oscr', 'NuIM', \&handler);
>
> But its handler function is passed a Mac::AppleEvents::Simple object.  So
the handler can do:
>
>     sub handler {
>          my $evt = shift;
>          my @data = $evt->get;
>
> So the new version works pretty well.  Check it out below.  Requires
Mac::Glue, Chatbot::Eliza, and a version of Mac::AppleEvents::Simple not yet
on CPAN, but linked to below.
>
>
> --Chris
>
>
>
<SNIP>


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org