If you are working on a Macintosh, AppleScripts is probably the best way to try. I'm not skilled at that, but I'm sure there are people who can help you in the Apple Forums.