On Tuesday, March 26, 2002 at 09:01:46, Sridhar Boovaraghavan wrote:
> I would like to keep my Yahoo Address Book and the BBDB in sync. Has
> anyone have any pointers to utilities that can do this? Yahoo Address
> Book can export and import a CSV file. I looked at bbdb-pilot-jwz.el
> from Noah Friedman and this does something similar.
Well not really for a sync, but for pushing the BBDB into a
CSV ... probably this is similar to code in bbdb-pilot-jwz.el
(defun rf-bbdb-csv-export ()
"Write a CSV file with the data of the records listed in the BBDB buffer."
(interactive)
(let ((records bbdb-records)
firstname lastname
addr street zip city country
phones telpriv teljob mobile fax
nets email email2
rawnotes birthday www notes mailalias
(fields '(("nickname" mailalias)
("Vorname" firstname)
("Nachname" lastname)
("Stra�e privat" street)
("Postleitzahl privat" zip)
("Ort privat" city)
("Staat privat" country)
("Geburtstag" birthday)
("Notizen" notes)
("Web-Seite" www)
("E-Mail-Adresse" email)
("E-Mail 2: Adresse" email2)
("Telefon privat" telpriv)
("Telefon gesch�ftlich" teljob)
("Mobilfunktelefon" mobile)
("Fax privat" fax)
))
rec)
(find-file "~/bbdb.csv")
(erase-buffer)
(let ((fields fields))
(while fields
(insert (format "%S" (caar fields)) (if (cdr fields) "," ""))
(setq fields (cdr fields)))
(insert "\n"))
(while records
(setq rec (caar records)
records (cdr records))
(setq firstname (bbdb-record-firstname rec)
lastname (bbdb-record-lastname rec)
addr (cadr (assoc "home"
(mapcar (lambda (p) (list (aref p 0) p))
(bbdb-record-addresses rec))))
street (and addr (bbdb-address-streets addr))
street (if street (mapconcat 'identity street ", "))
zip (and addr (bbdb-address-zip addr))
city (and addr (bbdb-address-city addr))
country (and addr (bbdb-address-country addr))
phones (mapcar (lambda (p) (list (aref p 0) p))
(bbdb-record-phones rec))
telpriv (and phones (assoc "home" phones)
(aref (cadr (assoc "home" phones)) 1))
teljob (and phones (assoc "job" phones)
(aref (cadr (assoc "job" phones)) 1))
mobile (and phones (assoc "mobile" phones)
(aref (cadr (assoc "mobile" phones)) 1))
fax (and phones (assoc "fax" phones)
(aref (cadr (assoc "fax" phones)) 1))
nets (bbdb-record-net rec)
email (car nets)
email2 (cadr nets)
rawnotes (bbdb-record-raw-notes rec)
notes (bbdb-record-notes rec)
birthday (and (assoc 'birthday rawnotes)
(cdr (assoc 'birthday rawnotes)))
mailalias (and (assoc 'mail-alias rawnotes)
(car (bbdb-split
(cdr (assoc 'mail-alias rawnotes))
",")))
www (and (assoc 'www rawnotes)
(cdr (assoc 'www rawnotes))))
(let ((fields fields))
(while fields
(insert (format "%S" (or (eval (cadar fields)) ""))
(if (cdr fields) "," ""))
(setq fields (cdr fields))))
(insert "\n"))))
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/