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

Find recently-modified Address Book entries Apps
After I Moved all my contacts from Now Up-To-Date the the Address Book, I slowly learned to live with Address Book's limitations. For various reasons (e.g. after synchronizing), however, I would like to know which contacts have changed.

The following AppleScript does just that for you. The output is placed on the clipboard, and formatted to be pasted into a spreadsheet. But since you have the code, you can modify ad lib. Enjoy!
(* Find recently modified entries in the Address Book

Input: a time interval (backwards from today) in the variable "daysBeforeToday"
Output: a string on the clipboard, format: YYYY-MM-DD (tab) Name (return)

©2009, Michael Bach, <www.michaelbach.de> *)

set daysBeforeToday to 7 -- <<<  change as desired or read from a dialog

tell application "Address Book"
  copy (current date) - daysBeforeToday * 24 * minutes * 60 to referenceDate
  copy (every person whose (modification date > referenceDate)) to modifiedPersons
  set s to ""
  repeat with aPerson in modifiedPersons
    set d to ((modification date) of aPerson) -- now change to international format and forget the hours
    set dateString to (year of d as string) & "-" & (my twoDigits((month of d) as number)) & "-" & (my twoDigits(day of d) as string)
    set s to s & dateString & tab & (name of aPerson) & return
  end repeat
  set the clipboard to s --for pasting into other applications
  s -- to view immediately in the script editor
end tell

on twoDigits(aNumber) -- trivial utility for formatting
  if aNumber < 10 then return "0" & (aNumber as string)
  return (aNumber as string)
end twoDigits
[robg adds: This worked as described for me, in 10.5.6. I'm not sure about 10.4.x compatibility.]
    •    
  • Currently 1.63 / 5
  You rated: 2 / 5 (8 votes cast)
 
[10,481 views]  

Find recently-modified Address Book entries | 13 comments | Create New Account
Click here to return to the 'Find recently-modified Address Book entries' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Smart Groups
Authored by: pwilcox on Feb 20, '09 08:04:47AM

I may be missing something here, but can't you use a smart group to pick up all of the contacts that have changed in the last day?



[ Reply to This | # ]
Smart Groups
Authored by: michaelbach on Feb 22, '09 02:45:45AM
Dear Mac-savvy colleagues:

You are so totally right that smart groups can do this and more -- thank you for pointing this out to me. I will now just consider it another learning step in AppleScript ;-)

As to robleach's question "I'm curious about these "limitations":
- limited export capabilities
- no list view which can be sorted by any criterion
- not possible to add fully custom fields. I smuggle them in as custom "spouse" or whatever (yes one can rename them, but they must fit into the general framework available for the template). For instance, sometimes I like flags (e.g., who gets our family chronicle), or the bank account and more.
I would appreciate being proved wrong on this too ;-).

Thank you, best, Michael.

[ Reply to This | # ]
Smart Groups
Authored by: msadesign on Feb 22, '09 05:02:49AM

Michael,

Why not just make a group called 'Family'? then, in Mail, in the 'To' field, simply type 'Family' and all of the email addresses spring right on over. Very clean. I use project numbers and do this for all my client contacts.



[ Reply to This | # ]
Smart Groups
Authored by: robleach on Oct 30, '09 10:26:09AM

I agree. Using smart groups is probably the tool to solve that issue. Generally, there are usually ways to do what you want to do that you may not be familiar with. The nice thing is that once you learn it for address book, you'll learn it for other apps at the same time because most everything is designed using the same organizational and functional concepts. However, I agree, more export options would be nice. I'd like to generate a tab-delimited file. I've done this before, but using some perl hacking. However, one tip to discover more hidden "export" options is to hit print, which allows you to "export" to PDF. The format is somewhat customizable.



[ Reply to This | # ]
Smart Groups
Authored by: brucio on Feb 23, '09 09:48:52AM
Appreciate the effort- I too recently made the switch from Now Contact to Address Book and have been trying to figure out work-arounds to deal with Address Book's limitations. I figured out this particular problem using a Smart Group as mentioned, but the one that still vexes me is how to add extra fields and field labels. This hint is promising (http://www.macosxhints.com/article.php?story=20051221232010333), but I'm paranoid that any changes I make won't survive an Address Book.app update, especially this close to the release of OS 10.6. Anyone have any clues on the state of Address Book development?

[ Reply to This | # ]
Find recently-modified Address Book entries
Authored by: rjbailey on Feb 20, '09 08:16:32AM

Yes, I believe you can just use a smart group--I just did it myself. I didn't know this was possible.



[ Reply to This | # ]
Find recently-modified Address Book entries
Authored by: CJYetman on Feb 20, '09 08:28:44AM

Smart Group in Address Book works for me...

Card : has changed in : 7 : days



[ Reply to This | # ]
Find recently-modified Address Book entries
Authored by: robleach on Feb 20, '09 08:55:37AM

I'm curious about these "limitations". I've only ever used Address Book. What functionality/features am I missing out on?



[ Reply to This | # ]
Find recently-modified Address Book entries
Authored by: kirsch on Feb 20, '09 09:19:35AM

What I'd like is a smart folder, or at least a script to figure out which ones of my contacts have a picture.

Nicer still - which one have a large iPhone picture and which ones have the small icon.



[ Reply to This | # ]
Find recently-modified Address Book entries
Authored by: ChaChi on Feb 20, '09 11:29:44AM

--this returns the names of people who don't have pix...
tell application "Address Book" to return name of people whose image is missing value

--this returns the names of people who do have pix...
tell application "Address Book" to return name of people whose image is not missing value

Hope this helps!



[ Reply to This | # ]
That sync-ing feeling
Authored by: ptwithy on Feb 20, '09 12:30:08PM

If you are truly paranoid about sync-ing going wrong (I am), you can open iSync (which is essentially useless these days) and in Preferences check the box for Show Data Change Alert when, and pick 'any', of the data on the computer will be changed.

Then you will get a dialogue where you can review the changes a sync is going to make any time it would try.

The one drawback is that I sometimes notice my MobileMe sync spinning away in the menu bar, and it is because the 'Data Change Alert' has gotten buried under other windows. F9 to the rescue, in that case...



[ Reply to This | # ]
iSync is useful!
Authored by: rodneyweston on Feb 20, '09 12:53:11PM

I sync my Nokia E51 using iSync... remember most people don't have an iPhone. However, thanks for the preferences tip - when I have made lots of updates on my phone, I want more control of the sync process.



[ Reply to This | # ]
That sync-ing feeling
Authored by: salman22 on Feb 23, '09 03:47:10AM
This is a TEST Comment Salman Khan Salman Khan http://www.google.com/

[ Reply to This | # ]