Doing it in KiX or any other scripting language would require that you kludge together an assortment of external utilities. Do it in C++ if you are proficient at it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.