0

The other question asks the same but using AppleScript. Apple introduced JavaScript as a new language for Automation in OS X 10.10.

2

From Terminal,

osascript -l JavaScript -e "app=Application.currentApplication(); app.includeStandardAdditions = true; app.displayNotification('Hello, world', {withTitle: 'Title'})"

From Script Editor,

app = Application.currentApplication()
app.includeStandardAdditions = true
app.displayNotification('Hello, world', {withTitle: 'Title'})
| improve this answer | |
  • 1
    We need to link to the API documentation on the displayNotification function; I don't know what other parameters it accepts. – Sridhar Ratnakumar Sep 18 '14 at 4:02
  • The documentation is available in Script Editor's Library under StandardAdditions / User Interaction / displayNotification. The other available options are subtitle and soundName. – Chris Kobrzak Oct 3 '16 at 10:31

Not the answer you're looking for? Browse other questions tagged .