Introduction: Learn VBS Programming for Pranks, Cool Stuff, Ect.

Picture of Learn VBS Programming for Pranks, Cool Stuff, Ect.

This instructable is to teach you thew basics of Batch and VBS programming, whether you want to make a talking clock, a simple calculator program, or just need a few ideas for April fools. ;)

VBS is a programming language built into windows. Have you ever wondered how to make a window pop up and say anything you want it to? Have you ever wanted to scare your friends or parents with a really convincing fake virus? Make someone think their computer is sentient? What about make your computer talk to you?

If so, you've come to the right place! :D

A ton of credit goes to Super_Nerd and his Awesome instructable, thanks for such a detailed and comprehensive guide, and for a lot of the information in this instructable.

Note: These will only work on windows machines. Sorry, mac users. :/

Step 1: The Begining Basics: Your First Message Box

Picture of The Begining Basics: Your First Message Box

Surprisingly, there is very little to do for our first message box.

First, open notepad,

Next, type this in (Or copy/Paste)

x=msgbox("Message", 0 ,"Message along the top")

You can replace the Message and Message along the top with whatever you like. Keep the parenthesis though.

Click File, then Save as

Make sure you select "All files (*.*)" instead of "Text Documents (*.txt)" before saving, otherwise it will save it as a plain text document.

Type the name you want to save it as, followed by a .vbs

Save the file, then run it. If you did everything correctly, you should see a message box pop up on the screen! Now you can move on to customizing icons and buttons!

Step 2: The Begining Not So Basics: Adding Buttons and Icons!

Picture of The Begining Not So Basics: Adding Buttons and Icons!

Ok, so you've made your first message box pop up. Great! Now how do you add more buttons, options, and icons?

Did you notice the zero in the line here?

x=msgbox("Message", 0 ,"Message along the top")

The numbers there define what buttons and icons appear.

For the buttons:

0 - ok button

1 - ok and cancel

2 - abort, retry and ignore

3 - yes no and cancel

4 - yes and no

5 - retry and cancel

For the icons:

16 - critical message icon

32 - warning icon

48 - warning message

64 - info message

To use these, simply add the numbers to the code like this:

If I wanted a warning icon and yes and no buttons, I would write this:

x=msgbox("Is this a warning?", 4+32 ,"Warning!")

The number for the buttons goes first, then a plus sign, and then the icon number.

Now you should know how to add different buttons and icons to your message box!

Step 3: Have Fun With Message Boxes!

Picture of Have Fun With Message Boxes!

Ok! Now that you now the basics, you can prank your friends, awe them with your supreme skills of computer hacking, or just play around with it for fun!

A tip:

This is the code for the message boxes shown in the pictures for this step:

x=msgbox("When your computer talks back to you, then you know you're going crazy.", 48+2 ,"Perhaps this is just your imagination.")
y=msgbox("Actually, I think you really do need to see a doctor. Or maybe I should call an asylum?", 16+0 ,"A doctor would be recomended.")

Notice I put both commands in one file. You can do this, and they will play one after the other.

Step 4: Make Your Computer Talk to You!

Picture of Make Your Computer Talk to You!

So you want your computer to talk to you? It's very easy! Another simple VBS script, and it will be talking away!

Open notepad.

Copy in this code:

'
set speech = Wscript.CreateObject("SAPI.spVoice")

speech.speak "Hello Master, I am ready to do your bidding."

You can replace the "Hello Master, I am ready to do your bidding." part with whatever you like. Same as with the message boxes, keep the parenthesis.

Click File, then Save as
Make sure you select "All files (*.*)" instead of "Text Documents (*.txt)" before saving, otherwise it will save it as a plain text document. Type the name you want to save it as, followed by a .vbs, then save it.

Run it and 'see' (Hear) the results!

Step 5: Text Input Window:

Picture of Text Input Window:

Here's how to make a window that accepts a text input from you.

Type this into Notepad:

var=inputbox ("Text in window","text at top of window","default text")

The variable var is where the input is stored.

This doesn't do much by itself, but you can add it to other things to make something cool!

Step 6: Inspiration, Ideas, and Tips

Picture of Inspiration, Ideas, and Tips

If this has been enough for you, then good! I hope it helped! If not, I hope to add more later, but for now, take a look at Super_Nerd's very detailed instructable on the subject: https://www.instructables.com/id/The-Ultimate-VBS-T...

To make a VBS (Or Batch) file run when the computer
has been started up and logged onto, find the Startup folder under All Programs, and put your file(s) into it. When your unsuspecting victim logs on, they will be greeted by it!

Other cool things:

Text to speech program:

x=inputbox ("Enter text to convert into speech:","Text to speech convertor","Enter text")
' set speech = Wscript.CreateObject("SAPI.spVoice") speech.speak x

Password Program:

x=inputbox ("Please Enter Password","Please enter Password","")
if x = "Pizza is the Password" then x=msgbox("Correct! Welcome, Master!", 0 ,"Welcome, Master!") else x=msgbox("Incorrect.", 0+16+0+4096 ,"Password Fail") end if

I hope this instructable helps some people, comments and constructive criticism are always welcome! ;D

Comments

Padmac (author)2015-05-01

how is the Text to speech supposed to work! ? i'm not getting it!

Jfieldcap (author)Padmac2015-05-01

What part are you looking at? The step titled "Make your computer talk to you" is not the same thing as the picture for "Text input window". I'm sorry if that was confusing to anyone. Are you trying to do what it shows in the picture? (It might be helpful if you would copy/paste your code too)

Padmac (author)Jfieldcap2015-06-05

oh m sorry i got it! i was talking about step-4 but it doesn't display any dialogue box! i can just hear the voice!

Jfieldcap (author)2015-05-12

Entered in the Coded Creations contest! Please vote if you think it deserves it!

About This Instructable

4,059views

62favorites

License:

Bio: I am a electronic maniac. I take things apart to see how they work or what I could use out of them, and I love ... More »
More by Jfieldcap:The ProtoBot Project - Super Affordable Educational RobotsRestoring a Vintage CalculatorLEDs for the clueless beginnner
Add instructable to: