使用 applescript 发送短信

send text message with applescript

我想在 OS X Yosemite 上使用 AppleScript 和 iCal 自动向我的一位特殊叔叔发送短信。这可能吗?这是我写的 AppleScript:

using terms from application "Messages"
on service_type with SMS
    send this_Message to this_buddy with this_Chat
    set this_name to the name of this_buddy
    if the name of this_buddy is in {Uncle, Jose} then
        set canned_responses to {Happy, Birthday, Uncle, Hose}
        set this_messsage to canned_responses
    end if
end service_type

停止使用来自

的条款

这行得通吗?现在还不是他的生日,所以我真的不能 运行 剧本,我是说我可以,但它没有提供任何反馈。任何帮助将不胜感激。

tell application "Messages"
    -- Create variable containing the name of how your uncle is listed in your contacts
    set theBuddy to buddy "Contact name"

    -- Send the text. Change "Text message" to your own message
    send "Text message" to theBuddy
end tell