I am trying to create an applescript that will grab all of the labeled phone numbers of 'mobile' and 'iPhone' from the every contact in Contacts App (specifically the phone numbers from the iCloud account), and then send an iMessage or SMS to them using Messages App.
I think I have a good part of it, but I get 2 errors that I can't seem to understand.
tell application "Contacts" repeat with eachContact in (get every person) repeat with eachPhoneNum in (get phones of eachContact) if label of eachPhoneNum is "mobile" or "iPhone" then delay 2 tell application "Messages" set myid to get id of first service set theBuddy to buddy eachPhoneNum of service id myid send theMessage to theBuddy end tell end if end repeat end repeat end tell
Corrected Error 1:
Contacts got an error: Can’t get label. As script is above.
Still experiencing Error 2:
Can’t make «class az20» 1 of «class azf4» id "89E7AF18-A017-4119-B788-CBB96571FAAE:ABPerson" of application "Contacts" into the expected type.