Sam Daniel
Sam Daniel

Reputation: 1902

Applescript to read notifications to the Apps in Dock

I want to be able to have a script which can detects if I have new messages in my messaging apps.. Slack, lync,.

Is it possible to use applescript to read if there is any active notification on the apps in the Dock..

Upvotes: 1

Views: 877

Answers (1)

clemsam lang
clemsam lang

Reputation: 460

If you do:

`getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db

(which line I found at Ask Different), you'll get returned:

/var/folders/_d/pg2g_[some_funny_numbers]/0//com.apple.notificationcenter/db: is a directory

Inside this/my folder I found:

db   db-shm   db-wal   db2upgraded

When some action happens (I sent a notification) only db-wal gets updated (nearly) at once.

So, in principle it should be possible to write an AS (saved as Stay Open app) that periodically looks if "db-wal" has changed (comparing saved sizes or change dates) and, ONLY if so, searches it for some keywords (Slack, lync,…) again comparing # of occurrences, thus learning if s.th. new has arrived. Admittedly sounds awkward but could work.

It would be much more elegant to use a folder script, but as no file is moved nor a folder opened/closed such a script can not be invoked.

Upvotes: 1

Related Questions