• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: address book export to .addressbook file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address book export to .addressbook file


  • Subject: Re: address book export to .addressbook file
  • From: pete boardman <email@hidden>
  • Date: Sun, 4 Sep 2005 10:06:05 +0100

On 3 Sep 2005, at 05:29, Patrick Collins wrote:

After this information is extracted from addressbook, then I need to
modify the .addressbook file and add to it:

Nickname+(TAB)+Fullname+(TAB)+Fcc+(TAB)+Comment

A script to do this shouldn't be too difficult. A first approximation is this (I have no idea whether the resulting file actually works with 'pine'):


--
set rList to {}
tell application "Address Book"
repeat with p in people
tell p
set {elist, theNickName, theNote} to {{}, "", ""}
if (count emails) > 0 then
repeat with e in emails
set end of elist to e's value
end repeat
set AppleScript's text item delimiters to ","
set elist to elist as text
set AppleScript's text item delimiters to " "
end if
if nickname is not missing value then set theNickName to nickname
if note is not missing value then set theNote to note
set end of rList to theNickName & tab & name & tab & elist & tab & theNote & return
end tell
end repeat
end tell
set fileRefNum to (open for access ((path to desktop) as text) & "addressbook" with write permission)
write (rList as text) to fileRefNum
close access fileRefNum
--


Apart from error handling (omitted), a possible problem here is that the note field in Address Book can contain returns, whereas presumably the addressbook file cannot. So they would need to be processed.

Also, I would join this new file to the existing one after checking them, rather than merge them in the script (I'm cautious about that sort of thing...).


Pete


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >address book export to .addressbook file (From: "Patrick Collins" <email@hidden>)

  • Prev by Date: Re: still having trouble with SOAP
  • Next by Date: Re: still having trouble with SOAP
  • Previous by thread: Re: address book export to .addressbook file
  • Next by thread: How can I tell when an app is bouncing on the Dock?
  • Index(es):
    • Date
    • Thread