Adrian Nier Code

Back to overview

Fill missing country

Last modification: Friday, January 29, 2010 02:38 am

Asks for a country to fill the missing fields for all addresses of the people in the Address Book.

Implementation


repeat
   -- Ask for a country
   activate
   set _country to text returned of (display dialog "Please specify the country:" default answer "")
   if _country is not "" then exit repeat -- Do not allow empty strings
end repeat

-- Go through all the people in the address book
tell application "Address Book"
   repeat with _person in people
      repeat with _address in (addresses of _person)
         if (country of _address) is missing value then
            set country of _address to _country
            save
         end if
      end repeat
   end repeat
end tell