Cocoa-AppleScript to open and close applications when an other launches or terminates