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

mik*_*sey 0 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
Run Code Online (Sandbox Code Playgroud)

我正在尝试显示emailFrom,emailTitle和emailMessage,所以它的格式如下: 在此输入图像描述

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
Run Code Online (Sandbox Code Playgroud)

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

小智 7

试试这种方式:

display notification "Notification Text" with title "Title" subtitle "SubTitle"
Run Code Online (Sandbox Code Playgroud)

=>

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
Run Code Online (Sandbox Code Playgroud)