It's probably possible, but its going to be some work. The clunky way would be with Sendkeys. You might also be able to do with Dynawrapper or AutoIT.

An example of dynawrap (with links to download, etc in the header) is ToggleQL() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=190048#Post190048