Applescript 如何通过Messages.app自动发送文本,而不考虑收件人';s操作系统?

Applescript 如何通过Messages.app自动发送文本,而不考虑收件人';s操作系统?,applescript,sms,imessage,Applescript,Sms,Imessage,我的目标是使用FileMaker的执行AppleScript步骤(因此告诉应用程序“FileMaker”不在下面的脚本中),在macOS上将自动文本发送到FileMaker记录中的电话号码 这些联系人不在contacts.app的数据库中,因此告诉app“Messages”发送…不是选项,至少不是直接发送 这是我目前的剧本 set _delay to 0.5 set _phone_number to repetition 1 of cell "APPLESCRIPT_PIPE" of layo

我的目标是使用FileMaker的
执行AppleScript
步骤(因此
告诉应用程序“FileMaker”
不在下面的脚本中),在macOS上将自动文本发送到FileMaker记录中的电话号码

这些联系人不在contacts.app的数据库中,因此
告诉app“Messages”发送…
不是选项,至少不是直接发送

这是我目前的剧本

set _delay to 0.5

set _phone_number to repetition 1 of cell "APPLESCRIPT_PIPE" of layout "DEV"
set the clipboard to _phone_number

set _msg to repetition 2 of cell "APPLESCRIPT_PIPE" of layout "DEV"

tell application "System Events"
  tell process "Messages"
    set frontmost to true
    keystroke "n" using {command down}
    delay _delay

    keystroke "v" using {command down}
    delay _delay

    keystroke return
    delay _delay

    tell text area 1 of scroll area 4 of splitter group 1 of window 1
      set value to _msg
      delay _delay

      keystroke return

    end tell

  end tell
end tell

activate
当向iPhone发送文本时,这项功能完美无瑕,但当收件人使用没有iMessages的手机时,有时无法发送

单击“未送达”按钮,然后单击“重试”,通过短信发送

告诉app“Messages”发送…
如果电话号码在Contacts.app数据库中有效,至少在我测试过的一些数据库中有效,但将联系人添加到数据库中,然后尝试向该联系人发送文本无效。以下是我尝试过的脚本:

tell application "Contacts"
  set _person to make new person with properties¬
    {first name:"Bruce", last name:"Wayne"}
  tell _person
    make new phone at end of phones of _person with properties¬
      {label:"mobile", value:"1234567890"}
  end tell
  save
end tell

tell application "Messages"
  send "Chuck's test" to buddy "1234567890" of service "SMS"
end tell
联系人确实会添加到数据库中,但消息不会发送。没有生成错误,只是不发送


有人知道如何确保安卓手机的短信第一次通过,或者,作为一种备用方法,有人知道如何检测它们没有通过吗?

我开发了一个Filemaker脚本,可以通过iMessage或SMS发送消息(无需将好友添加到联系人应用程序)。正如Filemaker所熟悉的,您可以

  • 使用要发送的文本设置变量$Message
  • 使用PhoneNumber设置变量$PhoneNumber(通过“+0123456789”过滤)
  • 将“执行Applescript”步骤与计算出的Applescript一起使用,如下所示:
  • “显示对话框”“发送短信”“默认应答”“和$Message&”“按钮{”“取消”“,\”“确定”“}默认按钮2”“和&
    “将结果作为列表复制到{按下按钮,返回文本}”&”&
    “如果按下的按钮为“确定”,则”&
    “告诉应用程序”消息“&”&
    “发送文本”返回给“短信”服务的好友\”“和$PhoneNumber&“\”&
    “结束讲述”和&
    “如果结束”

    我添加了一个对话框,可以在Filemaker数据库中编辑自动格式化的消息。我的下一步是能够在发送的短信中添加ical事件。。。欢迎任何意见;-)