Может быть, это решение будет работать немного лучше для вас, вместо использования системных событий ...
set theMessage to "Whatever Text To Send"
set thePhoneNumber to "555-555-5555" -- Any Phone Number INCLUDE THE QUOTE MARKS
-- * Other Acceptable Phone Number Formats *
-- ("1(555)555-5555","(555)555-5555", "5555555555", "15555555555")
tell application "Messages"
launch
delay 5 -- Gives Messages Time To Open (May Need To Adjust)
send theMessage to buddy thePhoneNumber of service "SMS"
end tell
Если вышеприведенное решение не работает для вас, вы можете установить значения напрямую, а не с помощью буфера обмена .. Вот так ...
set theMessage to "Whatever Text To Send"
set thePhoneNumber to "555-555-5555" -- Any Phone Number INCLUDE THE QUOTE MARKS
-- * Other Acceptable Phone Number Formats *
-- ("1(555)555-5555","(555)555-5555", "5555555555", "15555555555")
tell application "Messages" to activate
tell application "System Events"
delay 1 -- May Need To Adjust
click UI element "Compose" of splitter group 1 of window ¬
"Messages" of application process "Messages"
delay 1.5 -- May Need To Adjust
set value of text field "To:" of scroll area 3 of splitter group 1 of window ¬
"Messages" of application process "Messages" to thePhoneNumber
keystroke return
delay 1.5 -- May Need To Adjust
set value of text area 1 of scroll area 4 of splitter group 1 of window ¬
"Messages" of application process "Messages" to theMessage
delay 2 -- May Need To Adjust
keystroke return
end tell