Applescript 如何检查号码是否已在iMessage中注册?

Applescript 如何检查号码是否已在iMessage中注册?,applescript,imessage,Applescript,Imessage,我正在寻找一种方法来确定一个号码是否已在iMessage中注册。到目前为止,我知道如何使用以下脚本发送消息: set number to "+111111111111" set message to "Test" tell application "Messages" set targetServise to 1st service whose service type = iMessage set targetBuddy to buddy number of targetSer

我正在寻找一种方法来确定一个号码是否已在iMessage中注册。到目前为止,我知道如何使用以下脚本发送消息:

set number to "+111111111111"
set message to "Test"
tell application "Messages"
    set targetServise to 1st service whose service type = iMessage
    set targetBuddy to buddy number of targetService
    delay 1
    if targetBuddy exists then
        send message to targetBuddy
    end if
    #delay 5
end tell
我现在只需要知道这个号码是否已在iMessage中注册


附言:有什么API吗?

据我所知,AppleScript只能向您以前在macOS或iOS上的messages.app中发送过消息的人发送消息;您无法使用新号码开始新的对话,即使联系人中已存在此人。因此,这个问题没有可应用的现实世界背景。但出于好奇,不,没有官方API(但你可以用谷歌搜索其他人编写的非官方API,但我怀疑它是否适合AppleScript)。谢谢你的回复。AppleScript只是一个建议。我的意思是,如果还有其他选择,我很乐意接受@CJKA据我所知,AppleScript只能在macOS或iOS上的messages.app中向您以前发送过消息的人发送消息;您无法使用新号码开始新的对话,即使联系人中已存在此人。因此,这个问题没有可应用的现实世界背景。但出于好奇,不,没有官方API(但你可以用谷歌搜索其他人编写的非官方API,但我怀疑它是否适合AppleScript)。谢谢你的回复。AppleScript只是一个建议。我的意思是,如果还有其他选择,我很乐意接受@CJK