(*
Earthlink enables importing of addressbook values in .csv (comma separated value) format, but it seems to be somewhat picky about the format and a header line with the correct values is required. It seems to deal with mac, windows or unix linebreaks and doesn't seem to care if all values have quotes around them.
The simplest useful format seems to be:
"First Name", "Last Name", "Middle Name", "Name", "Nickname", "E-mail Address", "E-mail 2 Address", "E-mail 3 Address"
the "Name" field shows up as "Display Name"
Earthlink has some information on importing csv data to the web mail address book here.
If you want to see an example .csv file, you can go to your Earthlink Web Mail Preferences, click on the Addressbook section, and then you can export your current Addressbook and examine the format. Not everything is exported though, for example "Title". It will import if added to a .csv, but it doesn't export.
The csv file must have an additional linebreak at the end after the last entry, or the last entry will be ignored.
Also, if phone numbers are included, the importer seems to put the business phone entry into the "Home Fax", "Mobile Phone", "Business Phone", "Business Fax", "Pager" if there is a value in those fields instead of the actual value that's in those fields.
I created an applescript to export data from the Mac OS X Address Book to a compatible .csv file for uploading to the Earthlink Webmail.
Also, a simpler version of the applescript exports only names and email addresses.
*)
(*
Earthlink requires a return at the bottom of the csv or it ignores last record
office phone, cell phone, pager, and fax all seem to be filled by business phone
*)
set theValues to {"Title", "First Name", "Last Name", "Middle Name", "Name", "Nickname", "E-mail Address", "E-mail 2 Address", "E-mail 3 Address", "Home Phone", "Home Fax", "Mobile Phone", "Business Phone", "Business Fax", "Pager", "Other Phone", "Home Street", "Home City", "Home Postal Code", "Home State", "Home Country/Region", "Business Street", "Business City", "Business Postal Code", "Business State", "Business Country/Region"}
set theLine to my list2string(theValues)
set theData to theLine
set theResult to button returned of (display dialog "Include all records in Address Book, or only records with E-mail addresses?" buttons {"Cancel", "Only with E-mails", "All records"} default button 3)
tell application "Address Book"
set thePeople to every person
--set thePeople to people 1 through 3
set theCount to 0
repeat with eachPerson in thePeople
set theEmails to emails of eachPerson
set c to count theEmails
if theResult = "All records" or c > 0 then
set theTitle to title of eachPerson
set theTitle to my setValue(theTitle)
--0 Title
set theValues to {theTitle}
set theNameFirst to first name of eachPerson
set theNameFirst to my setValue(theNameFirst)
--1 First Name
set theValues to theValues & {theNameFirst}
set theNameLast to last name of eachPerson
set theNameLast to my setValue(theNameLast)
--2 Last Name
set theValues to theValues & {theNameLast}
set theNameMiddle to middle name of eachPerson
set theNameMiddle to my setValue(theNameMiddle)
--3 Middle Name
set theValues to theValues & {theNameMiddle}
--4 Name (Display Name)
set theName to name of eachPerson
set theName to my setValue(theName)
set theValues to theValues & {theName}
--5 Nickname
set theNameNick to nickname of eachPerson
set theNameNick to my setValue(theNameNick)
set theValues to theValues & {theNameNick}
set theEmails to emails of eachPerson
set c to count theEmails
--6,7,8 E-mail Address (1 through 3)
repeat with x from 1 to 3
if (c ≥ x) then
--return value of item x of theEmails
set theValues to theValues & {my setValue(value of item x of theEmails as string)}
else
set theValues to theValues & {""}
end if
end repeat
--"Home Phone","Home Fax","Mobile Phone","Business Phone","Business Fax","Pager","Other Phone"
set thePhoneEquivList to {"home", "home fax", "mobile", "work", "work fax", "pager", "other"}
set thePhoneList to {"", "", "", "", "", "", ""}
set thePhones to phones of eachPerson
set c to count thePhones
set theExtraPhones to {}
repeat with x from 1 to c
set theLabel to label of item x of thePhones
set theValue to value of item x of thePhones
if theLabel is in thePhoneEquivList then
repeat with i from 1 to count of thePhoneEquivList
if item i of thePhoneEquivList = theLabel then
set item i of thePhoneList to my setValue(theValue)
exit repeat
end if
end repeat
else
set theExtraPhones to theExtraPhones & (theValue & " " & theLabel as string)
end if
--return properties of item x of thePhones
end repeat
repeat with eachPhone in theExtraPhones
repeat with y from (count thePhoneList) to 1 by -1
if item y of thePhoneList = "" then
set item y of thePhoneList to my setValue(eachPhone)
exit repeat
end if
end repeat
end repeat
set theValues to theValues & thePhoneList
--"Home Street","Home City","Home Postal Code","Home State","Home Country/Region"
set theHomeAddresses to {"", "", "", "", ""}
set theBusinessAdresses to {"", "", "", "", ""}
set theAddressEquivList to {"street", "city", "zip", "state", "country"}
set theaddresses to addresses of eachPerson
set c to count theaddresses
set theExtraaddresses to {}
repeat with x from 1 to c
(*
if theCount = 1 then
return properties of item x of theaddresses
end if
*)
set theLabel to label of item x of theaddresses
if theLabel = "home" then
set item 1 of theHomeAddresses to my setValue(street of item x of theaddresses)
set item 2 of theHomeAddresses to my setValue(city of item x of theaddresses)
set item 3 of theHomeAddresses to my setValue(zip of item x of theaddresses)
set item 4 of theHomeAddresses to my setValue(state of item x of theaddresses)
set item 5 of theHomeAddresses to my setValue(country of item x of theaddresses)
else if theLabel = "work" then
set item 1 of theBusinessAdresses to my setValue(street of item x of theaddresses)
set item 2 of theBusinessAdresses to my setValue(city of item x of theaddresses)
set item 3 of theBusinessAdresses to my setValue(zip of item x of theaddresses)
set item 4 of theBusinessAdresses to my setValue(state of item x of theaddresses)
set item 5 of theBusinessAdresses to my setValue(country of item x of theaddresses)
end if
end repeat
set theValues to theValues & theHomeAddresses & theBusinessAdresses
set theLine to my list2string(theValues)
set theData to theData & return & theLine
set theCount to theCount + 1
end if
end repeat
end tell
set theData to theData & return
set theCSVfile to choose file name with prompt "Save the exported data:" default name "AddressBook.csv" default location (get path to desktop folder from user domain)
set myFileReference to open for access theCSVfile with write permission
set eof of myFileReference to 0
write theData to myFileReference
close access myFileReference
beep
say "Wrote " & theCount & " address records" as string
on list2string(theList)
set AppleScript's text item delimiters to "\",\""
set theLine to theList as string
set AppleScript's text item delimiters to ""
set theLine to "\"" & theLine & "\"" as string
return theLine
end list2string
on setValue(theItem)
if theItem = missing value then
set theItem to ""
else
set AppleScript's text item delimiters to the "\""
set searchListlist to every text item of theItem
set AppleScript's text item delimiters to "\"\""
set theItem to the searchListlist as string
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to the return
set searchListlist to every text item of theItem
set AppleScript's text item delimiters to ", "
set theItem to the searchListlist as string
set AppleScript's text item delimiters to ""
end if
return theItem
end setValue
-- simpler version of the applescript exports only names and email addresses
-- applescript page
(*
Earthlink's page says these fields can be imported:
Title
First Name
Middle Name
Last Name
Suffix
E-mail Address
E-mail 2 Address
E-mail 3 Address
Business Street
Business Street 2
Business Street 3
Business City
Business State
Business Postal Code
Business Country
Home Street
Home Street 2
Home Street 3
Home City
Home State
Home Postal Code
Home Country
Other Street
Other Street 2
Other Street 3
Other City
Other State
Other Postal Code
Other Country
Company
Department
Job Title
Assistant's Phone
Business Fax
Business Phone
Business Phone 2
Callback
Car Phone
Company Main Phone
Home Fax
Home Phone
Home Phone 2
ISDN
Mobile Phone
Other Fax
Other Phone
Pager
Primary Phone
Radio Phone
TTY/TDD Phone
Telex
Assistant's Name
Birthday
Manager's Name
Notes
Other
Address PO Box
Spouse
Web Page
Personal Web Page
Anniversary
Profession
Nickname
Nickname
Birthday
Categories
*)