Better multi-country support in Contacts | Winfred van Kuijk

Better multi-country support in Contacts

By • Published: January 4, 2010 • Last updated: June 4, 2023 • Filed in: Software

Share
Here is a free plug-in that I have written for Apple’s Contacts (Address Book) that provides better multi-country support:

  • country names: you no longer have many variations for country names (so: all “United States”, instead of many variations like “USA”, “US”, “United States of America”);
  • country address formats: it tells Contacts to use the formatting that belongs to that country (e.g. my default format is for the Netherlands, which normally means for US addresses that state is missing and zip and city are switched).

Before (left): non-standard country name and incorrect format (state is missing, zip and city are switched)
After (right): standard country name and correct format

Quite useful for those that have contacts in multiple countries. You can specify in the script what countries to check and what your preferred country names are. Missing/unknown countries are added as a group in Contacts.

Simply download and run, or install as plug-in in /Library/Address Book Plug-Ins ~/Library/Application scripts/com.apple.AddressBook (location appears to have changed in 10.9.2.

September 2014: v1.9 introduces progress meter (available in Yosemite), user request added (only process contacts in defined group), bug fixes.


68 Responses to “Better multi-country support in Contacts”

  1. John Graybeal says:

    Nice tool. But I am confused by something basic here. If I understand your work correctly, the country code does several things: (1) Indicates the country of the address for that contact. (2) Tells iphone (and others?) what the telephonic country code is. (3) Tells Address Book how to format this entry (or if empty, tells Address Book to use the default format).

    Do I understand this correctly? So if I want to not show a country in my Address Book contact displays, I have to reset all the country codes to “”? Seems like poor separation of content and view. What am I missing?

    • winfred says:

      Hi John, There are 3 items: a) the phone country code (e.g. +31-…), b) the country name field, c) the “hidden” field: country code. And: all three are unrelated. By setting the country code (c), address book is told what the displayed format is of the address (e.g. changing the display order of zipcode and city). Hope this helps.

  2. Reginald W says:

    Found this on MacOSX Hints and just wanted to let you know that your 1.4 script seems to work on Tiger (10.4.11) running on an iBook G4. The OSX Hints web site said it was only for 10.6 and 10.5. Place it into the Library/… instead of into the user setting.

    Being anal-retentive or ADD or something like that, I did put your list into iso code order to make it easier to find/edit an entry, added the “Allemagne” to Germany as in your example but that wasn’t in the script, preferred Germany over Deutschland and added Canada to the list as follows:

    copy {“be”, {“Belgium”, “België”, “Belgique”}} to end of clist — I like to use the English name for this country
    copy {“ca”, {“Canada”, “canada”, “Kanada”, “Kanata”}} to end of clist
    copy {“de”, {“Germany”, “Deutschland”, “Allemagne”}} to end of clist
    copy {“fr”, {“France”}} to end of clist — example of country with no aliases, only needed if not loading iso list
    copy {“gb”, {“United Kingdom”, “UK”}} to end of clist
    copy {“nl”, {“Netherlands”, “Nederland”, “the Netherlands”, “NL”}} to end of clist
    copy {“us”, {“United States”, “USA”, “US”, “United States of America”, “Estados Unidos”}} to end of clist
    copy {“ve”, {“Venezuela”}} to end of clist — example of overwriting the standard name from the iso list
    copy {“”, {“Chile”}} to end of clist — example: I don’t like Apple’s Chile format, leave iso code empty for default country format

    However, if I have “canada” in all lower case as the country name in the address book, the script does NOT change it to “Canada”, converting the lowercase “c” to “C”. Perhaps it works in Leopard/Snow Leopard, but not in Tiger, at least for me. Very minor point, not sure if it is anything worth fixing or not, just thought that I would point it out.

    I would suggest adding the comment in the instructions that if someone who is entering in country names always enters in a name that is always misspelled, just add the misspelling as an alias to let it correct it automatically instead of bringing it up to be corrected manually. As this would apply for the one misspelling it, it wouldn’t do to have it as an example, but simply as guidance. You mention about misspelling in your .PNG file above, but not in the 1.4 script except in the section on writing to the log file. Having it in your instructions section would make it more easily explainable.

    — you only need to add countries here if you want to a) use a non-iso name and/or b) if you want to add aliases and/or c) someone
    — is always misspelling a country name and you want to auto-correct it.
    — the iso names can be found at the bottom of the script

    The only other thing would be standardizing for province/state names or abbreviations in the same way as you are doing for country names, but more work for someone who knows scripting. I would ASSume that it would be a lot more difficult as it would require looking at the country name and then a list of province/state names that go with that country. For Canada, US and Mexico, the province/state name abbreviations WERE unique until Newfoundland changed from NF to NL and conflicted with one of the Mexican state abbreviations. Just a thought, not a request, but I’m sure people wouldn’t turn it down if implemented, but I would guess this would be a LOT of work to do.

    Thanks for this. First script for Address Book that I’ve put in. Actually, I think it is the first script I’ve put in period. I’m not a programmer and I’ve never gotten into scripting, Applescripting or other such things, although I’ve thought of trying to learn more about it. Going to have to look further into this though since your example worked so well. Take care.

    • winfred says:

      Hi Reginald, I have the feeling Twitter is not your thing, that limit of 140 characters would never work for you. 😉
      – lower/upper case: will think about it, for searching it is actually nice that it is case insensitive (find both “allemagne” and “Allemagne”);
      – will modify the comment according to your suggestion, thx;
      – province/state: that is beyond the scope 🙂

      • Reginald W says:

        I’ve heard that before! LOL! Verbose does not mean “my stereo”. LOL

        I’d rather be complete and long than short and the person I’m sending to not having a clue as to what I’m saying, or having to ask a zillion questions for them to know exactly what I meant. Thanks again for the script.

  3. Egidius says:

    Goedemorgen Winfred, ik krijg elke keer als ik probeer het script te installeren de mededeling dat ik eerst mijn settings moet updaten. Maar van wat en waar? Of heb ik iets over het hoofd gezien? Eerst wilde hij ook nog Growl-helper hebben plus de vraag om de settings te updaten, maar na installatie van Growl krijg ik alleen deze mededeling. Wat doe ik fout?

    Groet en dank, Hans

    • winfred says:

      De installatiestappen van de plug-in: open het script met AppleScript Editor de stukken aan tussen ###…###. Met name: de landen tabel en de variabelen. Pas als “I_am_ready” op true gezet is kan het script gebruikt worden. Er is een ingebouwde lijst van (Engelse) landennamen, wil je Nederlandstalige landnamen, zet deze dan in de tabel in het script. Voor Engelse uitleg, zie de “How to install & run the script” en “Customize the script” secties op de webpagina.
      Voor Growl, mijn script kijkt of Growl draait en maakt er gebruik van als dat het geval is. Van de Growl-helper is mij niets bekend, kan het zijn dat een oude versie van Growl dit zelf oproept?

      Nog meer vragen, stuur gerust een mail via het contact formulier.
      -Winfred

  4. […] delas é o suporte a múltiplos países. Graças ao desenvolvedor Winfred van Kuijk, porém, agora temos à disposição um plugin que promete resolver isso. Veja um rápido exemplo do que ele […]

  5. B says:

    Sorry, just disregard my question above. Obviously I just have to drag and drop the changed entries to the Exchange address book and they get updated there.

    Thanks again for this!

  6. B says:

    Hi Winfred, this seems to be a very useful script. I just tested it with your testing entries. However, I am running 10.6.2 and use Address Book exclusively with Exchange (no local addresses “On My Mac”. When running your script, it copied the testing entries to my local address book and changed them (correctly) there. But the entries on my Exchange address book remain unchanged. Any idea how I can use your script to change the entries on the Exchange server?

    Thanks!

  7. Q says:

    Brilliant idea to output the missing countries.

    • winfred says:

      In that case: you will like v1.4, these missing (and unknown) countries are added to Address Book groups. Available now, enjoy.

  8. Daniel says:

    This doesn’t work for me… I can do a single entry, but as soon as I reset the script to process all address book contacts, growl informs me that the script has started, then nothing, not even after half an hour (and there are only 458 cards in my address book). Sometimes, though not always, the Text Edit application launches, but it doesn’t come to the foreground by itself and the window is empty. Incidentally, when I process a single entry, the summary at the end is displayed in Growl, not in TextEdit. Any suggestions? I’m running 10.6.2 on an early 2008 Mac Pro Intel Xeon (2 quad-core Intel Xeons).
    Thanks,
    Daniel

    • Daniel says:

      SInce Winfred handles comments like the one I posted above off-line, it may appear to the casual browser that he does not react to issues reported on this page. Nothing could be further from the truth! After I reported my problem, I received an almost instant email reply, and after several more emails had been exchanged, my problem is now completely solved. In fact, I just sent the author the following email a few seconds ago:

      OK, Winfred, I think everything is cool now. I picked up a version of my address book from the day before I ran the script for the first time; I then downloaded and ran the latest version. Everything went perfectly well; the two groups in the address book were really created and contained entries that should really have been there. OK, I thought, now I simply have to manually updated my 9 problem contacts. Wrong! They had all been handled by the updated scripts already.

      I guess it is safe to say that version 1.4 now works perfectly well for me. Thank you so much for not only providing a valuable tool but for also taking the time to troubleshoot my individual problem. Isn’t it amazing that those who provide free services to the community also provide the best support? Great job!

      Vriendelijke groeten,

      Daniel

  9. Bobbi Style says:

    I had installed the script yesterday into Address Book on Snow Leopard 10.6.2 and it crashed immediately. Winfred got hold of me and we went back and forth trying different solutions. It turns out that the crash was caused by two versions of BTGoogleEarth trying to run at the same time. With Winfred’s help I managed to remove all traces of it and do a clean install which fixed the crashing issue completely.

    I must say a HUGE thanks to Winfred on emailing back and forth until this was fixed when it wasn’t even caused by Winfred’s script!
    Your little script was a massive upgrade to my Address Book Winfred!
    Carry on the good work 🙂
    Bobs

  10. Jeff Byrnes says:

    Too cool! Thanks for such a useful script.

  11. László says:

    Hi,
    your script migh come handy, as I share my time (and friends) between Hungary and the US. However, I cannot get over the “First check the settings” warning/error. Whatever I do, and however many times I restart Address Book, I cannot get over this. What should I do?

    Thanks.

    • winfred says:

      Before you can run the script, you need to open the script, modify the country list and set the I_am_ready parameter to true. This is needed because every country and even every person has his favorite names for countries. Hope this helps!

  12. Alex says:

    This is perfect! Thanks!

  13. King Kong says:

    Hi
    it does not work without Growl as far as I can tell. I modified it and then ran it and got a Growl error as a standalone app.
    Growl HelperApp not found.

    I do not use growl and do not want to use growl.

    Regards
    kay

  14. Pablo Toledo says:

    One question: you can change the format assigned by country? In the case of Chile, is simply wrong!

    • winfred says:

      That’s beyond my powers I am afraid. 😉 That is hard-coded by Apple.

    • Emlyn says:

      You could try to find another country that has the correct format for Chile, and use that ISO code.
      Or report the bug to Apple…

    • winfred says:

      Good suggestion. I have also made a quick update (v1.2.2), you can now also leave the country code field empty, it will then pick the default country format. Or as you wrote: use another country code.

  15. winfred says:

    I just uploaded v1.2 and incorporated feedback from the OneMoreThing.nl forum: a better description of how to customize the country table. Enjoy!

Leave a Reply to László

« | Home | »

Loading...