Created
August 3, 2014 16:23
-
-
Save joefitzgerald/3fab2bcd3f590bf4c6cc to your computer and use it in GitHub Desktop.
Update gopivotal.com Email Addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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