Skip to content

Instantly share code, notes, and snippets.

@luhui
Created March 3, 2015 01:26
Show Gist options
  • Select an option

  • Save luhui/84fd88598b55c5c4f225 to your computer and use it in GitHub Desktop.

Select an option

Save luhui/84fd88598b55c5c4f225 to your computer and use it in GitHub Desktop.
An apple script that transform the email address in contacts
tell application "Contacts"
repeat with i from 1 to (count every person)
set theEmailAddresses to properties of emails of person i
repeat with j from 1 to (count of theEmailAddresses)
if value of item j of theEmailAddresses contains "@cvte.cn" then
set oldAddress to value of item j of theEmailAddresses
set AppleScript's text item delimiters to {"@"}
set firstBit to first text item of oldAddress
set newAddress to firstBit & "@cvte.com"
set value of item j of emails of person i to newAddress
end if
end repeat
end repeat
save
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment