Yes. You can do this using AppleScript. This script should get you started.
For more information, see the wiki Searching the Forum for Answers section.