I wrote the following as a challenge from a coworker. It is pretty simple. It just brings up a command window and types in the same phrases that were used in the movie Matrix. It does have a random millisecond pause between each keystroke, to emulate typing. I hope there's nothing against posting something like this.
'Begin Script
Randomize
'to make sure the value is truly random for each keystroke
set objShell = WScript.CreateObject("WScript.Shell")
'The below launches the command line, goes to the c drive,
'changes the title to Matrix, turns of the c:\> prompt, and
'clears the messages on the screen
objShell.run "cmd /K C: & title Matrix & echo off & cls"
' 1 second pause to make sure the command window had a second to come up
slp 1000
'Send the words wake up, neo to the command window one key stroke at a time
splitstring "Wake up, Neo..."
slp 2000
'sends the Esc key to the command window to clear the typing -wake up, neo
SK "{ESC}"
splitstring "The Matrix has you..."
slp 2500
SK "{ESC}"
splitstring "Follow the white rabbit."
slp 2000
SK "{ESC}"
SK "Knock, knock, Neo."
slp 4000
SK "{ESC}exit{ENTER}"
sub splitstring (strng)
'This sub routine splits the string - strng- into one letter sections,
'runs the SK (SendKeys) sub for each letter, and has a random
'sleep/ pause in between each letter from 50-200 milliseconds
i=1
do until i>len(strng)
Char1=mid(strng,i,1)
SK Char1
wscript.sleep Int((200 * Rnd) + 50)
i=i+1
loop
End sub
sub SK(keys)
'Make sure the command window with the title -Matrix is selected
objShell.AppActivate "Matrix"
'send the key strokes -keys to the matrix window
objShell.SendKeys(keys)
End Sub
sub slp(ms) 'sleep however many millisecond specified
wscript.sleep ms
End Sub
<message edited by mcsajames on Thursday, December 02, 2010 5:17 PM>