AppleScript – Notification Center Documentation for AppleScript

applescriptmacnotificationsscript

Where can I find documentation for notification center method and properties to use it in applescript? I can't find anything in script editor's dictionary neither on web.

This is example code to work with notification center:

on run
    tell application "System Events"
        tell process "Notification Center"
           set theseWindows to every window
           display notification (count of theseWindows)
        end tell
   end tell
end run

Best Answer

Script Editor app has a searchable library. Open that under the window menu and then select the Standard Additions bundle. If you search for the term notification, you'll see it's defined under User Interaction:

display notification [text] : the body text of the notification
  [with title text] : the title of the notification (default is the name of the calling application).
  [subtitle text] : the subtitle of the notification
  [sound name text] : the name of the sound to play

But Notifications Center doesn't have any windows. Are you trying to count all windows for all applications?

To be clear - here's the notification part setting aside what a window count might be:

on run
    tell application "System Events"
        tell process "Notification Center"
            set theseWindows to "a b c"
            display notification (count of theseWindows)
        end tell
    end tell
end run