使用AppleScript通过通知中心发送消息

时间:2013-11-08 15:24:59

标签: applescript

使用OS X 10.9 Maverick,我正在尝试撰写AppleScript通知事件。

我已使用此代码成功发送了标题和副标题:

set emailFrom to "Johnny Appleseed"
set emailTitle to "The Email Subject"
set emailMessage to "Hello, this is a test"

display notification with title emailFrom subtitle emailTitle

我正在尝试显示emailFrom,emailTitle和emailMessage,因此它的格式如下: enter image description here

AppleScript Notification Center文档仅讨论标题和副标题。

我尝试将message添加到显示通知中,但它没有奏效。

set emailFrom to "Johnny Appleseed"
set emailTitle to "The Email Subject"
set emailMessage to "Hello, this is a test"

display notification with title emailFrom subtitle emailTitle message emailMessage

如何在通知中添加“消息”部分?

1 个答案:

答案 0 :(得分:7)

以这种方式尝试:

display notification "Notification Text" with title "Title" subtitle "SubTitle"

=>

set emailFrom to "Johnny Appleseed"
set emailTitle to "The Email Subject"
set emailMessage to "Hello, this is a test"

display notification emailMessage with title emailFrom subtitle emailTitle