I was annoyed by a behavior of Messages.app. When a friend sends me a message the chat window will not open automatically. Instead the Messages app icon will get a badge and bounce a couple of times in the dock.
But if I'm not currently at the computer, and since I do not use the Dock to launch apps and I have the Dock always hidden, I could easily miss a message for a long time. So I came up with the following solution.
First open /Utilities/AppleScript.app and paste the following into the script editor:
using terms from application "Messages" on message received theText from theBuddy for theChat set visible of window "Messages" to true end message received end using terms from
Mac OS X Hints
http://hints.macworld.com/article.php?story=20130409051205293