Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One way to sync Address Book smart groups to iPods etc. Apps
I got my iPod touch last week, and I realized that, even if it can sync my contacts and groups correctly from Address Book, it cannot sync smart groups. While it is possible to manually copy contacts from a smart group to a standard group, that is boring.

So, I decided to get myself to AppleScript, and built a little script that will help. For the script to work, it is simple: create your smart group and call it, let's say, SMyGroup (The "S" before meaning smart; otherwise name the group as you want). Built the smart group conditions to make it work the way you need. Then create a standard group called MyGroup. So you have two groups with similar names, with only a "S" in difference. That is necessary because I couldn't figure out how to distinguish smart from standard groups in Address Book via script. Then use this script:
tell application "Address Book"
  repeat with the_person in every person in group "MyGroup"
    add the_person to group "SMyGroup"
  end repeat
  save addressbook
  quit
end tell
Repeat those steps for each smart group to be put into a standard group, and in the AppleScript, just add more repeat loops. Execute it in AppleScript Editor, and your smart and standard groups will be identical, and will sync correctly to your iPhone or touch.

As a bonus hint, you can automate this in Automator. Open the application, and put an Automator » Run AppleScript action into the workflow area, and paste the above code there. Then save it as an iCal module and set it to execute, say, every day at 8:00 repetitively. Then, if you make a change on your computer or iPhone or Touch, you'll always have a fresh copy the of changes in all of them. Cool!
    •    
  • Currently 2.71 / 5
  You rated: 4 / 5 (7 votes cast)
 
[17,664 views]  

One way to sync Address Book smart groups to iPods etc. | 7 comments | Create New Account
Click here to return to the 'One way to sync Address Book smart groups to iPods etc.' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to sync Address Book smart groups to iPods etc.
Authored by: cdfmrl on Oct 15, '07 07:52:18AM

I assume that second "SMyGroup" should just be "MyGroup".



[ Reply to This | # ]
One way to sync Address Book smart groups to iPods etc.
Authored by: meall on Oct 15, '07 09:23:45AM

Yes, sorry, it is a typo. The line should be

add the_person to group "MyGroup"




[ Reply to This | # ]
One way to sync Address Book smart groups to iPods etc.
Authored by: mithras on Oct 15, '07 08:30:38AM

What if you create a manual group which has the Smart Group as its only member? I remember that being a workaround for Mail not playing nicely with smart groups; perhaps it will also work on iPods?

---
--
mithrastheprophet.net (coming soonish)



[ Reply to This | # ]
One way to sync Address Book smart groups to iPods etc.
Authored by: meall on Oct 15, '07 09:30:40AM

I just test it, create a group TEST and make a smart group to be a member of it, and on the iPod the group TEST is empty, no members.

SO, I would say it does not work unless I missed something...



[ Reply to This | # ]
One way to sync Address Book smart groups to iPods etc.
Authored by: morespace54 on Oct 16, '07 07:09:18AM

It's funny because it don't work for me... Maybe because I've got an iPod 5 gen and not an iTouch?
Anyway, it seems like no group can be added to my iPod contact... I only see people's names... Maybe I missed something :(



[ Reply to This | # ]
One way to sync Address Book smart groups to iPods etc.
Authored by: meall on Oct 19, '07 04:10:42PM

As long as I remember, the older iPods models only had a list of contacts. At least, my iPod photo has only this.

But this hint will be useful too if you plan to sync only a few groups, as you cannot select smart group to sync with an iPod.



[ Reply to This | # ]
One way to sync Address Book smart groups to iPods etc.
Authored by: LarsVegas on Dec 19, '09 10:31:36AM

Great i "enhanced the script further..

tell application "Address Book"
set group_list to name of every group
repeat with anItem in group_list
set AppleScript's text item delimiters to ""
repeat 1 times
if first item of anItem is not "$" then exit repeat
set AppleScript's text item delimiters to "$"

set gruppe to text item 2 of anItem

repeat with the_person in every person in group anItem
try
add the_person to group gruppe
on error
make new group with properties {name:gruppe}
end try
end repeat
save

end repeat

end repeat
return "Done"
end tell

Should probably do some cleanup and renaming to make it more readable... maybe later :)

basically create youre smart groups with a $ as the first character.. ($MyGroup)

script handles the rest.. makes MyGroup if it doesnt exist and adds all the contacts from $MyGroup



[ Reply to This | # ]