The question and answer at this link Send a text message from R use a function to create the AppleScript. I have copied it below
send_text = function(message){
system(paste('osascript -e \'tell application "Messages"\' -e \'send "', message,
'" to buddy "xxx-yyy-zzzz" of (service 1 whose service type is iMessage)\' -e \'end tell\''))
}
send_text("Hello world")
I'd like to modify the function so it can take both the message and the number, like this - send_text = function(number, message)
I can't figure out how the paste works to replace xxx-yyy-zzz
with the variable number
.