あいつにキー入力を送りたい

自動でキーボード入力をしたいという時に便利なのがSendInputというAPIです(詳細はこちら)。これを使えば好きな入力を最前面のウィンドウに対して送信出来ますが、やはりソース書いてコンパイルして...となるとメンドクサくて気軽に使うことは出来ません。
そんな私の気持ちを察してくれたのか、wshではShellのsendkeyというメソッドを使う事で同じことが実現出来るようです。ためしに一つスクリプトを作成してみました。

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "notepad.exe"
WScript.Sleep 1000
objShell.SendKeys "I"
WScript.Sleep 1000
objShell.SendKeys " "
objShell.SendKeys "h"
WScript.Sleep 100
objShell.SendKeys "a"
WScript.Sleep 100
objShell.SendKeys "v"
WScript.Sleep 100
objShell.SendKeys "e"
WScript.Sleep 1000
objShell.SendKeys " "
objShell.SendKeys "n"
WScript.Sleep 100
objShell.SendKeys "o"
WScript.Sleep 1000
objShell.SendKeys " "
objShell.SendKeys "m"
WScript.Sleep 100
objShell.SendKeys "o"
WScript.Sleep 100
objShell.SendKeys "n"
WScript.Sleep 100
objShell.SendKeys "e"
WScript.Sleep 100
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 10
objShell.SendKeys "e"
WScript.Sleep 1000
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "{BACKSPACE}"
WScript.Sleep 100
objShell.SendKeys "y"
WScript.Sleep 1000

WScript.Echo "終わり(閉じてね)"