I'm no pro, but I bet those who are, and might be able to help would say, what are your computer's stats? OS, ram, computer type, etc.
I bet there's an applescript somewhere that could do it.
Try
http://macscripter.net/ out, there are bound to be some people who could point you in the right direction.
Sorry I can't be of more help.