Skip to content

Instantly share code, notes, and snippets.

@kd0g
Created March 3, 2018 12:10
Show Gist options
  • Save kd0g/1abb70225a7b32f6043e09314f3aad9d to your computer and use it in GitHub Desktop.
Save kd0g/1abb70225a7b32f6043e09314f3aad9d to your computer and use it in GitHub Desktop.
MAC에서 전화번호 바꾸기 스크립트
tell application "Contacts"
-- repeat with aPerson in people of group "Test Group"
repeat with aPerson in people
set thePhones to phones of aPerson
if thePhones is not {} then
set errorList to {}
repeat with aPhoneNumber in thePhones
set theNumber to value of aPhoneNumber
try
set value of aPhoneNumber to my getNewNumber(theNumber)
on error
copy name of aPerson & return to end of errorList
end try
end repeat
if errorList is not {} then
display dialog "Couldn't change: " & items of errorList
end if
end if
end repeat
save
end tell
on getNewNumber(aNumber)
if aNumber starts with "010" then
set aNumber to text 4 thru -1 of aNumber
return "+82 10" & aNumber
else
return aNumber
end if
end getNewNumber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment