0

Using OS X 10.9 Maverick, I am trying to write an AppleScript notification event.

I've successfully sent a title and a subtitle using this code:

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

I am trying to display the emailFrom, emailTitle and emailMessage so it's formatted like this: enter image description here

The AppleScript Notification Center documentation only discusses title and subtitle.

I have tried adding message to the display notification, but it has not worked.

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

How can I add the "message" part to the notification?

mikebmassey
  • 8,354
  • 26
  • 70
  • 95

1 Answers1

7

Try it this way:

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
  • Note also this appears to be a new feature in [Mavericks](http://macosxautomation.com/mavericks/notifications/01.html). This does not work for me on OSX 10.8.5. – Digital Trauma Jan 06 '14 at 19:18
  • As of 10.10 it's possible to do this with JavaScript too. I posted this Q&A showing how: http://stackoverflow.com/q/27414831/102401. – Alan W. Smith Dec 11 '14 at 03:25