Is there a way to do this that is non-interactive?  I simply took the path of least resistance and scripted out what a person behind the keyboard would do.