Look here to learn how to create Visual Basic Scripts.

Using Visual Basic Script you can also access elementary Windows services, some them being really useful to irritate your friends. If at any point of the script there is an error stating that the double-quotes used in it are invalid characters, just delete the copied ones and type them again manually.
With the use of a shell, you can make VBScripts run programs and other executables. To do so you have to specify following line in the beginning of the script:

Set objShell = wscript.CreateObject("wScript.Shell")

Afterwards you can run commands with

objShell.run program

where you replace program with the program you want to run.
To add an executable to the autostart list via registry, you use the following script:

objShell.Regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\some_name.exe","C:\the\files\path.vbs

Replace the name with any name, it really can be any name, and the path of the file with the correct path. The script will then be executed on every start-up (be careful if you use this in combination with more dangerous scripts).
To make the script itself type as if it was the keyboard, use this script (a shell must be set for this as in the first script shown here):


Replace key_goes_here with the keys the script is supposed to hit. Some of them are embraced by curly brackets, as for example "{CAPSLOCK}", "{NUMLOCK}", "{SCROLLOCK}" and "{bs}" (backspace). Most however go without, as do all letter keys and enter ("~"). Combining all the locks with a loop usually gives a great script!
To make Windows' integrated voice say some words defined by you, use the following script:

Set objVoice = CreateObject("SAPI.SpVoice")
objVoice.Speak "blabla"

Replace blabla with some serious things your computer has to say to you.

Use of Shell, Registry, Keyboard and Voice in VBScript (Windows)
Tagged on:                                         

Leave a Reply

Your email address will not be published. Required fields are marked *