Typing without keyboard using VBScript

We can send a keystroke without using keyboard. We can easily do it programically by using VBScript.
We can shut down a computer, type anything without keyboard, run an application etc , by using VBScript.
For this a text editor like notepad is the only thing we needed.
So open notepad, paste the below code and save the file as anything .vbs.
The code to type key 'A' is

set shell=createobject("wscript.shell")
shell.sendkeys "A"

Now double click on the file to run it.

The code to open notepad is

set shell=createobject("wscript.shell")
shell.run "notepad"

The code to open notepad and activate it is 

set shell=createobject("wscript.shell")
shell.run "notepad"
wscript.sleep 100  'wait for notepad to load before activating it
shell.appactivate "notepad"

This can be very useful in the case of debugging also . If you make a breakpoint on an address and need to press F9 for a long time say 100 times, then it can be done by using vbscript. If the debugger is OllyDbg then. the below code is used.First run the debugger should be run.

set shell=createobject("wscript.shell")
shell.appactivate "OllyDbg" 'Specify the window title of the debugger to activate(focus) it
wscript.sleep 100 'wait for some time
for i=1 to 100
shell.sendkeys "{F9}"
wscript.sleep 50 'wait for some time
next

Comments