Created
October 2, 2013 20:26
-
-
Save apcomplete/6800017 to your computer and use it in GitHub Desktop.
AppleScript for displaying OSX notifications when receiving a message in Messages without displaying the message text in the notification.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "Messages" | |
on message received theMessage from theBuddy for theChat | |
tell application "Notifications Scripting" | |
-- This is required for calling the user notification event handlers. The handlers can be in a different script file. | |
set event handlers script path to (path to me) | |
-- The user info parameter is a record. The supported data types are text, integer, real, boolean, date, alias, file and POSIX file. | |
set dict to {theName:"Notifications Scripting", theVersion:"1.0", theScript:event handlers script path} | |
display notification "New Message" subtitle "From " & (theBuddy's name as string) message "" sound name "Default" user info dict | |
end tell | |
end message received | |
end using terms from | |
using terms from application "Notifications Scripting" | |
-- This handler is called when a notification was delivered. | |
-- All parameters are optionnals. | |
on notification delivered title aTitle subtitle aSubTitle message aMessage actual delivery date aDeliveryDate user info aDict | |
end notification delivered | |
on notification activated title aTitle subtitle aSubTitle message aMessage delivered date aDeliveryDate activation type aType user info aDict | |
tell application "System Events" | |
tell application "Messages" to activate | |
end tell | |
end notification activated | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment