Am using the following to get data from Address Book into an invisible file
so I can then place data into an app. Works well.
I want to be able to do this without Address Book app opening up (showing) at all so the
user just sees a seamless operation.
Suggestions?
tell application “Finder” to make file at desktop with properties {name:“Birthday export.txt”}
set exportFile to (((path to desktop) as string) & “Birthday export.txt”) as alias
tell application “Address Book”
set addressBookAsList to every person
open for access exportFile with write permission
repeat with i from 1 to count of addressBookAsList
set theName to (name of item i of addressBookAsList)
set eAddress to value of first email of item i of addressBookAsList
set theBirthDate to (birth date of item i of addressBookAsList) as string
write (theName & tab & theBirthDate & tab & eAddress & return) as string starting at eof to exportFile
end repeat
close access exportFile
quit application “Address Book”
end tell
I’m sure that it’s possible to write to the actual database file but I haven’t found anything in the scriptable, non-GUI world that does this. I’ve contacted various developers, including a request to Apple, to see if there was any interest in creating a command line tool, faceless application or osax to do this but, so far, I’m not aware of anyone who has done this. :?
I would be most interested in something like this and would be willing to help anyone (or ones), with more expertise than myself, create something like this. Apple’s Address Book is tedious and not very flexible. Unfortunately, it’s seems to be the only app that iSync will work with to sync with Bluetooth devices.
It would be nice to see something written that does for Address Book input, what some of your Apple Scripts (or even ‘contacts’) does for output.