gpt4 book ai didi

applescript - 仅在提供的服务中,如何使用applescript 发送imessage 文本?

转载 作者:行者123 更新时间:2023-12-03 13:05:18 27 4
gpt4 key购买 nike

有人可以告诉我如何通过消息应用程序直接向 iMessage 用户发送消息吗?

tell application "Messages"
if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 1
if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 2
if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 3

send "Message" to buddy "mail of name" of service x
end tell

我只需要通过 iMessage 向帐户发送消息,而不是通过 google talk、AIM、bonjour。
谢谢!

最佳答案

无需对 iMessage 服务进行硬编码,您可以自动找到它:

  • 将以下脚本另存为 sendMessage.applescript (注意:确保选择 文本 选项)。
  • 通过运行执行它:osascript sendMessage.applescript 1235551234 "Hello there!" .
  • 这将向电话号码 123-555-1234 发送包含文本“Hello there!”的 iMessage。

  • sendMessage.applescript:
    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

    关于applescript - 仅在提供的服务中,如何使用applescript 发送imessage 文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11812184/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com