Export Address Book

14 views
Skip to first unread message

Dougie Coull

unread,
Nov 5, 2003, 6:32:46 AM11/5/03
to
Hi Folks,

I'm sure this has been covered before, so apologies.

Are ther any tools out there that allows me to take my exported 'agent' address book, and put it in a format for
importing to other applications?

Many thanks.

Regards,

Dougie

>>>> Douglas Coull, Langbank, Scotland
>>>> Lat 55.92445 N Long 4.59753 W

Ralph Fox

unread,
Nov 7, 2003, 9:54:17 PM11/7/03
to
On Wed, 05 Nov 2003 11:32:46 +0000, in article
<krnhqvo3uk6llameu...@4ax.com>, Dougie Coull wrote:

> Hi Folks,
>
> I'm sure this has been covered before, so apologies.
>
> Are ther any tools out there that allows me to take my
> exported 'agent' address book, and put it in a format for
> importing to other applications?


Two options for you


1. 'Dawn' is a free address book converter.
http://www.joshie.com/projects/dawn/

Forté Agent is not on Dawn's list. However, Dawn's list _does_ say

|  Dawn works with the following programs:
...
|  • Other programs which can use/import/export LDAP/LDIF,
|  vCard (VCF), Comma Separated Value (CSV), plain text,
|  one per line or comma separated formats or store
|  addresses in a text file suitable for extraction.

-- http://www.joshie.com/projects/dawn/features.html

I have not tried Dawn so I don't know whether this means that
Dawn can be configured to extract addresses from the _exported_
'Agent' address book (which is after all a text file).



2. Below are two scripts "agent2nsldif.awk" and "agent2oecsv.awk"
for converting an exported Agent address book into:
• LDIF format for import into Netscape.
• CSV format for import into Outlook Express.

These scripts are not perfect and they will not handle some types
of address book entries. Read the known problems below.

These are AWK scripts. To run these scripts you will need
a copy of gawk.exe or awk.exe.

2.1 How to get gawk.exe

Go to http://unxutils.sourceforge.net/
download the file UnxUtils.zip
and extract the file gawk.exe from the zip file.

2.2 How to run the scripts.

2.2.1 Export your Agent address book to a file "addresses.txt".
2.2.2 Put the files "addresses.txt", "gawk.exe",
"agent2nsldif.awk" and "agent2oecsv.awk" into the
same directory.
2.2.3 Open a DOS window and change directory to this directory.

2.2.4 To convert the address book to LDIF format for import
into Netscape, run the DOS command

gawk.exe -f agent2nsldif.awk addresses.txt >addresses.ldif

2.2.5 To convert the address book to CSV format for import
into Outlook Express, run the DOS command

gawk.exe -f agent2oecsv.awk addresses.txt >addresses.csv


KNOWN PROBLEMS

• The script only converts email addresses that are enclosed in
angle brackets. Email addresses not in angle brackets will not
be converted.

• These scripts do not handle mailing lists. Only one address
per address book entry will be converted.

• If your Agent address book has an entry like this

Name: John the old fart
Addresses: John Citizen <john.c...@somewhere.invalid>

then Agent puts "John Citizen" and not "John the old fart"
in the headers of any email you send to (or cc) John.

When the address book is converted to Netscape or Outlook Express,
the converted address book will put "John the old fart" and
not "John Citizen" in the headers of any email you send to (or
cc) John. This might cost you a good working relationship.

There may be other problems which I have not uncovered yet.
These scripts were written for a particular use of mine.
They work OK for that particular use, but they might not
work OK elsewhere.


______________________________________________________________________
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Here are the two scripts "agent2nsldif.awk" and "agent2oecsv.awk"

agent2nsldif.awk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BEGIN {

x_name = "" ;
x_addr = "" ;

}


/^Name:/ {

s_tmp = $0 ;
x_name = substr(s_tmp,7) ;

}


/^Addresses:/ {

s_tmp = $0 ;

s_i = index( s_tmp, "<" );
s_j = index( s_tmp, ">" );

if ( s_i > 0 && s_j > 0 && s_i < s_j )
x_addr = substr( s_tmp, s_i + 1, s_j - s_i - 1 ) ;
else
x_addr = "" ;

}

/^Comments:/ {

if ( x_addr != "" )
{
printf( "dn: cn=%s,mail=%s\n", x_name, x_addr ) ;
printf( "cn: %s\n", x_name ) ;
printf( "mail: %s\n", x_addr ) ;
printf( "objectclass: top\n" ) ;
printf( "objectclass: person\n" ) ;
printf( "\n" ) ;
}

x_name = "" ;
x_addr = "" ;

}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

agent2oecsv.awk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BEGIN {

x_name = "" ;
x_addr = "" ;

printf( "Name,E-mail Address\n" );

}


function csv_sanitize( s_in, s_tmp, s_out )
{
s_tmp = ""
s_out = ""

if ( index( s_in, "\"" ) == 0 && index( s_in, "," ) == 0 )
return s_in ;

if ( index( s_in, "\"" ) == 0 )
return "\"" s_in "\"" ;


s_tmp = s_in ;
s_out = ""

while ( s_tmp != "" )
{
s_i = index( s_tmp, "\"" ) ;
if ( s_i == 0 )
{
s_out = s_out s_tmp ;
s_tmp = "" ;
}
else
{
s_out = s_out substr( s_tmp, s_i ) "\""
s_tmp = substr( s_tmp, s_i + 1 ) ;
}
}

if ( index( s_out, "," ) == 0 )
return s_out ;

return "\"" s_out "\"" ;

}


/^Name:/ {

s_tmp = $0 ;
x_name = substr(s_tmp,7) ;

}


/^Addresses:/ {

s_tmp = $0 ;

s_i = index( s_tmp, "<" );
s_j = index( s_tmp, ">" );

if ( s_i > 0 && s_j > 0 && s_i < s_j )
x_addr = substr( s_tmp, s_i + 1, s_j - s_i - 1 ) ;
else
x_addr = "" ;

}

/^Comments:/ {

if ( x_addr != "" )
{
printf( "%s,%s\n", csv_sanitize( x_name ), csv_sanitize( x_addr ) ) ;
}

x_name = "" ;
x_addr = "" ;

}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


______________________________________________________________________
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

--
Cheers,
Ralph

"There is only one boss, the customer. And he can fire everybody in
the company from the chairman on down, simply by spending his money
somewhere else." -- Sam Walton

Reply all
Reply to author
Forward
0 new messages