This code sends a text message from the command line
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
And this code sends an iMessage from the command line
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run
I’m looking for a solution to combine this code into a single snippet that will try to send an iMessage if the recipient has iMessages, but if they do not, then the code will send a SMS message.
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
And this code sends an iMessage from the command line
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run
I’m looking for a solution to combine this code into a single snippet that will try to send an iMessage if the recipient has iMessages, but if they do not, then the code will send a SMS message.