Notification Center message via AppleScript/osascript — specify an application name and icon

applescriptnotifications

When sending a notification to OS X's Notification Center via AppleScript's osascript, such as in:

osascript -e 'display notification "Finished that long running task." with title "Finally!"'

The Notification Center shows "AppleScript Editor" as the notification's source:

NotificationCenter

Is there a possibility to specify a different source (as in application) and icon when sending a notification this way?

Best Answer

I don't think it's possible with AppleScript but it is with terminal-notifier:

-sender ID         The bundle identifier of the application that should be
shown as the sender, including its icon.
-appIcon URL       The URL of a image to display instead of the application
icon (Mavericks+ only)

For example:

terminal-notifier -title title -message message -sender com.apple.TextEdit