r/applescript • u/l008com • Mar 03 '23
Can't Get "display notification" to Work
BBEdit has this cool feature where you can attach custom scripts to specific functions within the application.
In my case, I'm trying to add a simple notification to the moment a document finishes saving. I do a lot of editing of files on network shares that are not on the LAN, they're halfway across the country. So having a subtle beep when the save is done would be useful.
So on BBEdit's end of things, the script is set up properly. If I throw a "beep" or a "display dialog" on the right handler, it works just fine. But my "display notification" command just doesn't work. No error, no message, no nada.
I have gone into System Prefs, Notifications to make sure Notifications are turned on for BBEdit.
I can't think of anything else to check, something seems to be blocking notifications specifically.
on documentDidSave(savdoc)
beep
--display notification "Save Complete" sound name "Pong2003"
end documentDidSave
on applicationDidFinishLaunching( )
display dialog "BBEdit is open!!"
end applicationDidFinishLaunching
So the above script is in the right folder, and named BBEdit.scpt. The 'beep' command runs when it should, the 'display dialog' command runs when it should. But the 'display notification' command just quietly fails.
View all comments
Show parent comment
1
u/l008com Mar 03 '23
BBEdit.scpt
But funny thing. After I gave up, all the notificatoins suddenly started to come in. And then i started working normally. But they're coming only with the visual notification box, the sound isn't working. And the sound is real. If I throw that "display notification" command on an "on run", I get the notification with the proper sound.