0

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

closed as off-topic by Ian C. Sep 18 '14 at 4:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

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'})
  • 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 .