looks like someone has already made it.
http://www.mircscripts.org/showdoc.php?type=code&id=4491
its a great looking script btw, nice compact use of COM too.