How to export groups from an iCloud Address Book account using Automator? I’m using Mac OS X Lion with iCloud. My address book ‘lives’ on iCloud and I’ve gat a number of groups in the address book. 

Under Snow Leopard I used Automator to export addresses from a group using the following actions:


Get Selected Address Book Groups (Get selected “groups”)
Get Contact Information (Export Format “Spreadsheet (tabs)” with all fields selected, and Add Labels checked)
New Text File (Save as: “addresses.txt”, where “Desktop”)


– this worked like a charm, but since I got to use Lion, I only get the header filled with the labels, no addresses.

Although I do have a workaround (i.e. selecting all cards of a group and using “people” instead of “groups” in the first action of the workflow), I run in other problems like the fact I can’'t export to the MAC Roman encoding but must use UTF-8. In that case the address lines are garbled with mysterious spurious characters.

Is there a way to retrieve the individual contacts from a selection of Address Book groups in Automator, or is this a bug in Lion?
Apparently, Lion’s Automator actions are a bit more finicky about implicit data conversion between actions than Snow Leopard’s. In your case, the issue is the “Get Contact Information” action does not perform a conversion from groups into their contained  contacts. This can be solved quite easily by inserting a “Get Selected Address Book Items” action set to “people” after the first one (which retrieves the selected groups) before the “New Text File” action. This will allow you to select groups in Address Book instead of having to select all their constituent members.

As to the encoding issue, that does not seem to have anything to do with the Automator workflow: testing with my iCloud address book (German, with lots of Czech and French contacts) neither your nor my variant produce any issues writing UTF-8 text as long as the “New Text File” action’s file format is set to “text (.txt, convert if necessary)”. If the issue persists on your system when using these settings, possible causes I can think of are


TextEdit (or your editor of choice) is set to display the file as another encoding than UTF-8; in that case, it would mangle them on display.
your address book might contain differently encoded characters, possibly from importing from older systems: Address Book is very good at hiding these, but they can cause a number of odd issues. There are a number of utilities out there claiming to fix broken Address Book records, but I have never tested them – YMMV.