I'll see what I can do if I get 5 minutes...

Have you got a scripting language of some description set up?