Guide to VBScripting with Notepad
Table of content
- A brief introduction
- Getting started
- The icons
- Questions
- Funny codes
- Afterword
A brief introduction
I'm sure you all are familiar with this: You try to run a program, and a window with an error message pops up! Unfortunately, I am not going to explain you how to fix these problems. This guide is about how you can make your own Pop-ups. Enjoy!
Getting started
You don't have to install anything, all you need is the Notepad.
Let's start with some simple examples: Open Notepad, and write msgbox "test". (You can replace the "test" with anything.)
Save the file as test.vbs, and choose 'Desktop' as location. Hit the 'Save' button (Save the file under 'all files'!), and open the file on your desktop.
Then something like this should pop up:
Note: To change the Msgbox:
- Right Mousbutton → Edit
- Right Mousebutton → Open with: Notepad
Icons
Now we are going to add an icon and a title to the pop-up. Open a new Notepad, (or edit your previous one) and write: "test", 16, "title" (You can replace the words between the "" with anything.)
Once again, save it as 'All Files', on your Desktop and don't forget to name it anything.vbs!
Open it, and you should see something like this:
The 16 represents the red warning sign. Here are a few numbers you can replace it with:
- 32: Question mark
- 48: Yellow triangle with a black exclamation mark
- 68: Blue circle with an I(nformation)
- 4096: The Pop-up stays on the foreground
Questions
a) Ask a question
Open a new Notepad and write this:
Code:
a=inputbox("What is your name?")
msgbox "You have a nice name, "+a
(You can replace the words between the "" with anything.)
Once again, save it as 'All Files', on your Desktop and don't forget to name it anything.vbs!
Result:
b) Polar questions (yes/no questions)
Open a new notepad and write this:
Code:
if msgBox("Would you donate money to Unicef?", vbYesNo, "Question") = vbYes then
msgbox "That's very kind of you."
else
msgbox "Okay, it's YOUR money..."
end if
(You can replace the words between the "" with anything.)
Once again, save it as 'All Files', on your Desktop and don't forget to name it anything.vbs!
Then you should see something like this:
And so on.
Funny codes
A beep
The following code will activate a short 'beep'. (Speakers must be on)
Code:
Set oWS = WScript.CreateObject("WScript.Shell")
oWS.Run "%comspec% /c echo " & Chr(07), 0, True
Infinite beeps (Read how to stop the script first, at the end of the guide)
Code:
do
Set oWS = WScript.CreateObject("WScript.Shell")
oWS.Run "%comspec% /c echo " & Chr(07), 0, True
loop
Your computer can speak!
Code:
Set vo = CreateObject("SAPI.SpVoice")
vo.speak "Hello"
Change your MSN name
Code:
Set WshShell = CreateObject("Wscript.shell")
WshShell.Run ("msnmsgr.exe")
Wscript.Sleep 1200
WshShell.sendkeys "%x"
WshShell.sendkeys "O"
WshShell.sendkeys "(Enter MSN name here)"
Computer Disco
The following code makes your computer Caps Lock light flashing on/out.
Code:
Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}"
loop
Windows Wizard!
Code:
On Error Resume Next
StrAgentName2 = "MERLIN"
StrAgentPath2 = "C:\Windows\Msagent\Chars\" & strAgentName2 & ".Acs"
Set objAgent2 = CreateObject("Agent.Control.2")
ObjAgent2.Connected = TRUE
ObjAgent2.Characters.Load strAgentName2, strAgentPath2
Set objPeter = objAgent2.Characters.Character(strAgentName2)
ObjPeter.MoveTo 700,300
ObjPeter.Show
ObjPeter.Play "GetAttention"
ObjPeter.Play "GetAttentionReturn"
ObjPeter.Speak("Hello, I'm a wizard.")
wscript.sleep 10000
Infinite message (Read how to stop the script first)
Code:
do
msgbox"You can't stop me"
loop
Shut down your computer (There is no way back, so make sure all your work is saved!)
Code:
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
OpSys.ShutDown()
next
Important: How to stop the script:
- Control+Alt+Delete
- Task Manager
- Processes
- Search for Wscript.exe and end the process
Afterword
I spend quite a lot of time writing this guide, but I'm glad I did it. I would like to see some honest feedback from you, so please don't hestitate to tell me how to improve. If you have any questions, please feel free to PM me and I will get back to you as soon as possible. Thanks for reading and I hope I helped you!



































