In article <4079711B.3000106@ngmedia.com>,
ch@ngmedia.com (Christian Hansen) wrote:
> Ken Williams wrote:
> > Anyone have recommendations for how to do this nicely? I thought about
> > creating vCards and merging them somehow, but none of the CPAN vCard
> > modules seem to actually be able to create them. Also, I'm not exactly
> > clear on how I'd do the merge anyway. Is there some way to tap into
> > iSync or something?
>
> You can access AddressBook with PerlObjCBridge.
>
> perldoc PerlObjCBridge
> http://developer.apple.com/documentation/UserExperience/Reference/AddressBook/
> ObjC_classic/index.html
>
>
> Here is a example of inserting a person.
I've been called out! ;-) Here's a version with Mac::Glue.
#!/usr/local/bin/perl
use strict;
use warnings;
use Mac::Glue ':all';
my $ab = new Mac::Glue 'Address Book';
my $person = $ab->make(new => 'person',
with_properties => {
first_name => 'Stevie',
last_name => 'Wonder',
}
);
$ab->make(new => 'email', at => location(end => $person->prop('emails')),
with_properties => {
value => 'swonder@example.com',
label => 'work',
}
);
$ab->make(new => 'phone', at => location(end => $person->prop('phones')),
with_properties => {
value => '555-123-4567',
label => 'work',
}
);
$ab->make(new => 'phone', at => location(end => $person->prop('phones')),
with_properties => {
value => '555-890-1234',
label => 'home',
}
);
$ab->make(new => 'address', at => location(end =>
$person->prop('addresses')),
with_properties => {
street => '123 Main St.',
city => 'New York',
state => 'NY',
label => 'home',
}
);
__END__
--
Chris Nandor pudge@pobox.com http://pudge.net/
Open Source Development Network pudge@osdn.com http://osdn.com/
Thread Previous
|
Thread Next