title: How to register app launch listener in javascript for automation
body: <p>I'm trying to build a script with javascript for automation to prevent certain applications from launching in OSX. In the documentation, there is a <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/index.html#//apple_ref/c/data/NSWorkspaceWillLaunchApplicationNotification" rel="nofollow">NSWorkspaceWillLaunchApplicationNotification</a> notification. How can I listen for this notification, check which application is being launched, and then stop the application from launching?</p>
  
  <p>I'd like to be able to do it programmatically because I'm building an app for people to be able to block timewasting applications while they're working.</p>