Whow, a NumLock bug.
Anyway, I would rely more on COM scripting, because the line
 Code:
$ = SetFocus("Untitled - Notepad")
is depending on the language of the operating system