通过消息应用程序发送短信的简单 AppleScript 失败并出现错误 MacOs Monterey 12.0.1

发布于 2025-01-11 11:21:36 字数 459 浏览 0 评论 0原文

我希望使用 AppleScript 自动发送 SMS 文本,以控制 MacOS Monterey (12.0.1) 中的消息应用程序。我非常简单的测试脚本失败,并显示如下错误消息:

tell application "Messages"
    send "Test" to participant "123456789" of account "SMS"
end tell

运行脚本失败并出现以下错误:

错误“消息出现错误:无效的密钥表单。”来自帐户“SMS”的号码 -10002

显然,我使用的是我的联系人中的有效电话号码(我自己的)(事实上,脚本编辑器可以识别该号码并通过下拉列表提供其他信息)。 我使用的 MacBook Pro M1 设置为发送和接收短信,我一直使用它。如果我尝试通过将“SMS”替换为“iMessage”来发送 iMessage,我会得到相同的结果。感谢您的帮助。

I wish to automate the sending of SMS texts using AppleScript to control the Messages app in MacOS Monterey (12.0.1). My very simple test script fails with an error message as below:

tell application "Messages"
    send "Test" to participant "123456789" of account "SMS"
end tell

Running the script fails with this error:

error "Messages got an error: Invalid key form." number -10002 from account "SMS"

Obviously, I am using a valid phone number (my own) which is among my contacts (in fact, Script Editor recognizes the number and offers additional info via a drop down list).
The MacBook Pro M1 I'm using is setup to send and receive text messages, I use that all the time. I get the same result if I try to send an iMessage by replacing "SMS" with "iMessage". Thank you for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柳若烟 2025-01-18 11:21:36

尝试:

tell application "Messages"
    launch
    repeat while (count of windows) is 0
    end repeat
    set a to first account whose service type = SMS and enabled is true
    set p to participant "123456789" of a
    send "test, please ACK" to p
    -- properties of p
end tell

注意:您可能无法自己发短信,并且您可能需要已经给收件人发短信。

Try:

tell application "Messages"
    launch
    repeat while (count of windows) is 0
    end repeat
    set a to first account whose service type = SMS and enabled is true
    set p to participant "123456789" of a
    send "test, please ACK" to p
    -- properties of p
end tell

Note: You may not be able to text yourself, and you may need to already have texted the recipient.

落日海湾 2025-01-18 11:21:36
tell application "Messages"
    set iMessageService to 1st account whose service type = iMessage
    set imessagebuddy to participant "00301234567890" of iMessageService
    send "ignore the last messages. just testing. i am still the applescriptmaster" to imessagebuddy
end tell
tell application "Messages"
    set iMessageService to 1st account whose service type = iMessage
    set imessagebuddy to participant "00301234567890" of iMessageService
    send "ignore the last messages. just testing. i am still the applescriptmaster" to imessagebuddy
end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文