ios - iMessage Apple 脚本 - 尝试向可以是全名或号码的目标发送消息
问题描述
我正在尝试接受一个目标并让 if 语句确定它是电话号码还是全名。我似乎无法弄清楚如何从 iMessage 应用程序中找到全名。这是我到目前为止得到的,似乎只是当目标是非整数时。
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
launch application "Messages"
tell application "Messages"
set targetService to 1st account whose service type = iMessage
set targetPhoneNumber to "Alejandro Cervantes"
set targetMessageToSend to "Test"
if targetPhoneNumber is not integer then
set targetName to get id of account of participant targetPhoneNumber
set targetBuddy to participant targetPhoneNumber of targetService whose full name is targetPhoneNumber
else
set targetBuddy to participant targetPhoneNumber of targetService
end if
set targetMessage to targetMessageToSend
send targetMessage to targetBuddy
end tell
解决方案
推荐阅读
- r - 循环时,绘图区域顶部和底部的动态轴刻度具有一致的间隔数和一致的宽度(ggplot2,grid.arrange)
- python-3.x - 将带有字符串的数据框列转换为数字
- python - 用户输入后 OpenCV/Matplotlib 关闭窗口
- python - Plotly 表达标题样式
- python - 使用 Vaex 读取 Parquet 文件
- npm - 如何只下载 npm 项目之外的库?
- react-native - 在 React-Native 中关闭 useEffect 内存泄漏
- c# - 如何在 C# MVVM 中设置 UserControl 的 DataContext
- reactjs - 如何使用 useSelector() 钩子在多个减速器中获取属性?
- javascript - javascript 在点击或输入时验证和验证