Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joefitzgerald/3fab2bcd3f590bf4c6cc to your computer and use it in GitHub Desktop.
Save joefitzgerald/3fab2bcd3f590bf4c6cc to your computer and use it in GitHub Desktop.
Update gopivotal.com Email Addresses
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 "@gopivotal.com" 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 & "@pivotal.io"
set value of item j of emails of person i to newAddress
end if
if value of item j of theEmailAddresses contains "@pivotallabs.com" 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 & "@pivotal.io"
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