SetFocus() and SendKeys() are a kludgy way to automate as there is often insufficient feedback on the current screen to know if the app is ready for more keystrokes.

You should look into AutoIT which has the ability to read characters on the screen.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.