Use AppleScript to Format Contacts' E-Mail Addresses in All Lowercase
tell application "Address Book"
-- Go through each record.
repeat with thePerson in every person
-- A person can have multiple e-mail addresses.
repeat with account in email of thePerson
set emailAddress to value of account
-- Use Python to get the lowercase version This is less verbose than doing it all in AppleScript.
-- Set up to avoid a "privilege violation" error.
tell current application
set formatted to do shell script "python -c \"print '" & emailAddress & "'.lower()\""
end tell
set value of account to formatted
end repeat
end repeat
-- Save all Address Book changes.
save
end tell
Downloads
Comments