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

[MacPerl] OE5 Mac::Glue example



Hello,

I thought I'd post this in case someone found it useful.  I've been
struggling with Outlook Express 5 and using Mac::Glue to get messages.

Let say you have a folder called 'Cool Stuff' in OE5, and you're interested
in getting all of the messages.

#!perl -w

use strict;
use Mac::Glue;

my ($oe, $count, $cool_stuff, $msg);

$oe = new Mac::Glue 'Outlook_Express';

$cool_stuff = $oe->obj(folder => 'Cool Stuff');
# get the number of messages in Cool Stuff
$count = $oe->count($cool_stuff, 'each' => 'message');

for (my $i=1; $i < $count + 1; $i++) {
    $msg = $oe->obj(message => $i => $cool_stuff);
    print (('-' x 30)."\nMESSAGE $i\n");
    print $oe->get( $oe->prop(subject => $msg) );
    print "\n";
    print $oe->get ($oe->prop(content => $msg) );
}

__END__

What this will do is print the subject and content of each messages,
preceded by a separator and message number header.  To get other properties
of the messages, replace $oe->get ($oe->prop(content => $msg) )
                                             ^^^^^^^
the indicated word with the appropriate property.

If you have nested folders, so something like:

$fold = $oe->obj(folder => 'Nested Folder' => folder => 'Top Level Folder');

Enjoy!

-- 
Enrique Terrazas, MD
<mailto:terrazas@labmed.ucsf.edu>
<http://pangloss.ucsf.edu/~terrazas/>


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