Does anyone know how to generalize the code so that you can either send messages (blue iMessages) to recipients who have iMessages, and if recipients have an android device we can then and only then send us a text message (green sms) without having to have two separate scripts (i.e. 9 one for iMessages and one for SMS messages)
Post
Replies
Boosts
Views
Activity
I SOLVED IT! This code works.
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
set targetService to 1st service whose service type = SMS
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run
script editor edits the code automatically on run to this:
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
send targetMessage to participant phoneNumber of account "SMS"
end tell
end run
I have this same issue, and same code, but removing of service "SMS" did not solve my problem.