[Users] the adressbook: how can i copy/export simple name + eMail adress?
Jens
jens at 9dcf12.de
Sat Nov 19 14:19:52 CET 2011
Hello,
nice, it works fine. :) Unfortunality is this not an 'easy way' for normal users like my girlfriend. She can use the script, but she mean that a 'klick' is more intuitive. But I think, she would not use this script for a simpel thing. I like this script. ^^,
I think ClawsMail Adressbook need a plugin/funktion that exactly do this -> export to file and clipboard a adressbooklist. How can i make a feature request? :D
many thanks to you Owen and greetings,
Jens
Am Sat, 19 Nov 2011 07:22:08 +1100
schrieb Owen <rcook at pcug.org.au>:
> On Fri, 18 Nov 2011 11:46:34 +0100
> Jens <jens at 9dcf12.de> wrote:
>
> > Hello,
> >
> > yesterday i would simple copy a list of adresses from the
> > CM-Adressbook to a text file or via copy & paste to a text file or
> > drag & drop to a text file, like this format:
> >
> > name1 name1 at mail.mm
> > name2 name2 at mail.mm
> > name3 name3 at mail.mm
> > ...
> >
> > or this
> >
> > name1 name1 at mail.mm, name2 name2 at mail.mm, name3 name3 at mail.mm, ...
> >
> > But not easy way found to do this. The only way i found was the
> > export via LDIF. But in this exported file are many other
> > informations, like this:
> >
> > dn: cn=name1,zzxzx
> > objectClass: inetOrgPerson
> > cn: name1
> > sn: Some SN
> > displayName: Name1
> > mail: name1 at mail.mm
> >
> > dn: cn=name2,zzxzx
> > objectClass: inetOrgPerson
> > cn: name2
> > sn: Some SN
> > displayName: Name2
> > mail: name2 at mail.mm
> >
> > ...
> >
> > Is a easy way available to do this i wish?
>
>
> Here are a couple of perl scripts I wrote to do this. Just watch for
> any line wrap
>
> From with the addrbook directory
> ==============================================
> #!/usr/bin/perl
>
> use XML::Simple;
>
> #use Data::Dumper; #For debugging
> use strict;
>
> my $xml = new XML::Simple( KeyAttr => [], ForceArray => 1 );
>
> my $data = $xml->XMLin("addrbook-000004.xml");
>
> #print Dumper($data); #For debugging
>
> foreach my $d ( @{ $data->{person} } ) {
> print $d->{cn} . "\t";
> print $d->{'address-list'}[0]->{'address'}[0]->{'email'} . "\n";
> }
> =============================================
>
> and from the exported ldif of the address book
>
>
> =============================================
> #!/usr/bin/perl
>
> use strict;
> my $file = shift; #Just pass the first part of the file name.
> my $ldif_addresses = "/home/owen/Lanceslist.ldif"; #ldif extension
> my $ldif_sorted = "/home/owen/$file.sorted";
> open(my $FH, "$ldif_addresses" ) or die "cant open $ldif_addresses $!\n";
> open(my $OF, ">$ldif_sorted" ) or die "cant open $ldif_addresses $!\n";
> while (<$FH>) {
> chomp;
> my $line = $_;
> if ( $line =~ /cn: / ) { print $OF "$'\t"; }
> if ( $line =~ /mail: / ) { print $OF "$'\n"; }
>
> }
> close $OF;
> close $FH;
> open( $FH, "$ldif_sorted" ) or die "cant open $ldif_sorted $!\n";
> my @list = <$FH>;
> print " ";
> @list = sort { $a cmp $b } @list;
> print "@list";
>
>
> ==================================================
>
>
> Owen
>
>
>
>
More information about the Users
mailing list