【发布时间】:2018-09-06 22:24:42
【问题描述】:
我的目标是使用 FileMaker 的 Perform AppleScript 步骤在 macOS 上将自动文本发送到 FileMaker 记录中的电话号码(所以tell app "FileMaker" 不在下面的脚本中)。
这些联系人不在 Contacts.app 的数据库中,因此tell app "Messages" to send ... 不是一个选项,至少不是直接选项。
这是我当前的脚本。
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 的手机时,有时无法发送。
点击“未送达”按钮,然后点击“重试”通过短信发送。
如果电话号码在 Contacts.app 数据库中,tell app "Messages" to send... 可以工作,至少我已经测试过一些,但是将联系人添加到数据库然后尝试向该联系人发送文本不会工作。这是我尝试过的脚本:
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
联系人确实被添加到数据库中,但没有发送消息。不会产生错误,只是不发送。
任何人都知道如何确保发送到 Android 手机的文本第一次通过,或者作为后备,一种检测何时不通过的方法?
【问题讨论】:
标签: applescript sms imessage