The Ultimate VBS Tutorial
Intro: The Ultimate VBS Tutorial
VBS is one of the most popular programming languages on instructables so there surely will be several instructable guides on programming VBS. However, most of them rush through commands and just show the basic way to do them. They also have a lot of the same basic material. I decided to search all around instructables and w3schools.com until I had a very good list of commands. When I did I started this tutorial that really shows a lot of detail about each command. Now lets start making VBS scripts...
You will need...
-A computer running Windows 98 or higher (No Macs)
-Notepad
-Time
-A brain
You will need...
-A computer running Windows 98 or higher (No Macs)
-Notepad
-Time
-A brain
STEP 1: First Things First...
Open Notepad
Start>All Programs>Accessories>Notepad
Lets get ready to script!
Start>All Programs>Accessories>Notepad
Lets get ready to script!
STEP 2: Save Me!
Before we begin I should teach you how to save a vbs file in notepad.
To save a file you have to click File>Save As
Then type
name.vbs
Where it says name you can put whatever you want but it MUST end with .vbs
To save a file you have to click File>Save As
Then type
name.vbs
Where it says name you can put whatever you want but it MUST end with .vbs
STEP 3: Message Boxes
This makes an error message how you like it.
msgbox ("Message goes here",0+16,"Title goes here")
if the user is supposed to make a decision the variable can be added like this.
variable=msgbox ("Message goes here",0+16,"Title goes here")
The numbers in the middle vary what the messge box looks like.
Here is the list
0 - ok button only
1 - ok and cancel
2 - abort, retry and ignore
3 - yes no and cancel
4 - yes and no
5 - retry and cancel
TO CHANGE THE SYMBOL (RIGHT NUMBER)
16 - critical message icon
32 - warning icon
48 - warning message
64 - info message
DEFAULT BUTTON
0 = vbDefaultButton1 - First button is default
256 = vbDefaultButton2 - Second button is default
512 = vbDefaultButton3 - Third button is default
768 = vbDefaultButton4 - Fourth button is default
SYSTEM MODAL
4096 = System modal, alert will be on top of all aplications
Note: There are some extra numbers. You just have to add them to the numbers already there like
msgbox ("Hello World", 0+16+0+4096)
msgbox ("Message goes here",0+16,"Title goes here")
if the user is supposed to make a decision the variable can be added like this.
variable=msgbox ("Message goes here",0+16,"Title goes here")
The numbers in the middle vary what the messge box looks like.
Here is the list
0 - ok button only
1 - ok and cancel
2 - abort, retry and ignore
3 - yes no and cancel
4 - yes and no
5 - retry and cancel
TO CHANGE THE SYMBOL (RIGHT NUMBER)
16 - critical message icon
32 - warning icon
48 - warning message
64 - info message
DEFAULT BUTTON
0 = vbDefaultButton1 - First button is default
256 = vbDefaultButton2 - Second button is default
512 = vbDefaultButton3 - Third button is default
768 = vbDefaultButton4 - Fourth button is default
SYSTEM MODAL
4096 = System modal, alert will be on top of all aplications
Note: There are some extra numbers. You just have to add them to the numbers already there like
msgbox ("Hello World", 0+16+0+4096)
STEP 4: Input Boxes
Input boxes allow the user to INPUT a text string. Here is the code for one.
variable=inputbox ("Message","Title","Default Text")
Any of the text between the commas is optional by just not putting anything there like
variable=inputbox ("Type a Message",,"Message")
variable=inputbox ("Message","Title","Default Text")
Any of the text between the commas is optional by just not putting anything there like
variable=inputbox ("Type a Message",,"Message")
STEP 5: Working With Variables
Math is one of the most simple tasks for a computer. VBS can do complex math in a snap.
Vbs mainly does algebraic math but you can do other than that. First we should make a variable. That is the easiest task in the scripting world.
dim variable name here
Variables can be placed where text goes like this...
Msgbox (var)
The only rule for naming variables is no spaces allowed.
To do math, in between each part of the equation must have a space like so.
y + 5 = 6 * 8
You can also treat an equation like a variable...
Msgbox (5.5 * 3)
Note: VBS will give you an error specifically for dividing by zero so just don't do that.
Vbs mainly does algebraic math but you can do other than that. First we should make a variable. That is the easiest task in the scripting world.
dim variable name here
Variables can be placed where text goes like this...
Msgbox (var)
The only rule for naming variables is no spaces allowed.
To do math, in between each part of the equation must have a space like so.
y + 5 = 6 * 8
You can also treat an equation like a variable...
Msgbox (5.5 * 3)
Note: VBS will give you an error specifically for dividing by zero so just don't do that.
STEP 6: Strings
Strings are variables that hold text. You can make a string like this.
"This is a text string"
VBS will let you treat the text string as a variable but you can make a text string a variable as easy as this.
dim name
name = "This is a text string"
Note:You have to have the quotation marks or else the script will think your talking about a variable.
Note 2:Text strings do have a capacity limit to how much information they hold so be careful.
"This is a text string"
VBS will let you treat the text string as a variable but you can make a text string a variable as easy as this.
dim name
name = "This is a text string"
Note:You have to have the quotation marks or else the script will think your talking about a variable.
Note 2:Text strings do have a capacity limit to how much information they hold so be careful.
STEP 7: Decisions, Decisions...
What if you needed the program to check if a variable was at a certain value? In programming that is extremely easy. The decision making command is called the IF THEN ELSE statement. An example program would be...
if 200 > 16 then
msgbox ("200 is greater than 16")
else
msgbox ("200 isn't greater than 16")
end if
That was a foolish example (since 200 will always be greater than 16) of how the if statement works. So now you see IF 200 > 16 THEN let the user know ELSE tell the user it isn't then END the IF statement.
So now you can make a program that will do one of two things. Can you do more? Yes! That is called a nested IF statement. For example...
if 200 > 16 then
msgbox ("200 is greater than 16")
else
if 200 = 16 then
msgbox ("200 is equal to 16")
else
msgbox ("200 isn't greater than 16")
end if
end if
This program will say if 200 is equal to, greater than or less than 16.
The same can be used with text strings.
if userinput = password then
msgbox ("Welcome")
else
msgbox ("Access denied")
end if
Note that 'userinput' and 'password' are variable holding text strings not text strings themselves.
if 200 > 16 then
msgbox ("200 is greater than 16")
else
msgbox ("200 isn't greater than 16")
end if
That was a foolish example (since 200 will always be greater than 16) of how the if statement works. So now you see IF 200 > 16 THEN let the user know ELSE tell the user it isn't then END the IF statement.
So now you can make a program that will do one of two things. Can you do more? Yes! That is called a nested IF statement. For example...
if 200 > 16 then
msgbox ("200 is greater than 16")
else
if 200 = 16 then
msgbox ("200 is equal to 16")
else
msgbox ("200 isn't greater than 16")
end if
end if
This program will say if 200 is equal to, greater than or less than 16.
The same can be used with text strings.
if userinput = password then
msgbox ("Welcome")
else
msgbox ("Access denied")
end if
Note that 'userinput' and 'password' are variable holding text strings not text strings themselves.
STEP 8: Doing the Loop
What if you want a program to repeat something forever or until something happens? Have I got a command for you! It's the do loop command! Its most basic use is this.
do
msgbox ("Hi")
loop
A more complex version would be
do until 24 > 8
msgbox ("Hi")
loop
A similar version of that code would be
do
msgbox ("Hi")
loop until 24 > 8
While the two codes look the same there is a difference. That is, the first code won't even go into the loop if the criteria is met before the loop is started while the second one has to go through the loop at least once because the 'loop until' is after everything in the loop.
do
msgbox ("Hi")
loop
A more complex version would be
do until 24 > 8
msgbox ("Hi")
loop
A similar version of that code would be
do
msgbox ("Hi")
loop until 24 > 8
While the two codes look the same there is a difference. That is, the first code won't even go into the loop if the criteria is met before the loop is started while the second one has to go through the loop at least once because the 'loop until' is after everything in the loop.
STEP 9: Important Command
One of the things that makes VBS special is it can work with other programs that are compatible with it by creating something called an object. In other words a VBS script can get more commands by controlling other programs. To use objects you have to let the script know what you are going to call it. Here is how you set an object...
set name = wscript.CreateObject("what the object is")
It is a good idea to set objects in the first lines of your code. There are two reasons for that.
1.It makes your program clearer to read.
2.It's impossible to use an object that hasn't been set. Its best to get that done first to avoid errors.
The next two steps will show two examples of objects.
set name = wscript.CreateObject("what the object is")
It is a good idea to set objects in the first lines of your code. There are two reasons for that.
1.It makes your program clearer to read.
2.It's impossible to use an object that hasn't been set. Its best to get that done first to avoid errors.
The next two steps will show two examples of objects.
STEP 10: Shell
Say you want your script to do something like run a program or DOS-ish commands. This object is perfect. It is called the Windows Shell object. Here is a simple way to use it to open a directory.
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run C:\Windows
The C:\Windows folder should open.
Another command is sendkeys. It will, well, send keys, to applications. Say you want to send hello world into a program, just type.
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.sendkeys "Hello World"
Another command is the Echo command which sends a message box with no picture, an OK button, and Windows Script Host in the title. An example is.
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.echo "Hello World"
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run C:\Windows
The C:\Windows folder should open.
Another command is sendkeys. It will, well, send keys, to applications. Say you want to send hello world into a program, just type.
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.sendkeys "Hello World"
Another command is the Echo command which sends a message box with no picture, an OK button, and Windows Script Host in the title. An example is.
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.echo "Hello World"
STEP 11: Sapi
Did you ever want to make a computer talk? Sure you could open the text to speech window, but what if you want a computer to read results without any user interface? Just use the SAPI (Speech Application Programming Interface) object.
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "Hello world"
The speak command can also use variables.
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak variable
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "Hello world"
The speak command can also use variables.
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak variable
STEP 12: Date and Time
These commands will show the date or time if used correctly. They can be treated like variables.
--------------------(Date)-------------------------
Date (Returns system date)
Day (Returns the day (1-31)from the date command) ex. Day (Date)
Month (Returns the month (1-12) from the date command) ex. Month (Date)
Year (Returns the year from the date command) ex. Year (Date)
--------------------(Time)------------------------
Time (Returns the current system time to the second)
Second (Returns the second (0-59) from the time command) ex. Second (Time)
Minute (Returns the minute (0-59) from the time command) ex. Minute (Time)
Hour (Returns the hour (0-23) from the time command) ex. hour (Time)
For example
msgbox (Date)
msgbox (Time)
That is a simple program that shows the use of the Date and Time commands.
A more elaborate program that uses all of the commands listed here and some extra can be found here .
--------------------(Date)-------------------------
Date (Returns system date)
Day (Returns the day (1-31)from the date command) ex. Day (Date)
Month (Returns the month (1-12) from the date command) ex. Month (Date)
Year (Returns the year from the date command) ex. Year (Date)
--------------------(Time)------------------------
Time (Returns the current system time to the second)
Second (Returns the second (0-59) from the time command) ex. Second (Time)
Minute (Returns the minute (0-59) from the time command) ex. Minute (Time)
Hour (Returns the hour (0-23) from the time command) ex. hour (Time)
For example
msgbox (Date)
msgbox (Time)
That is a simple program that shows the use of the Date and Time commands.
A more elaborate program that uses all of the commands listed here and some extra can be found here .
STEP 13: Reading Plain Text
Say you want the computer to read from a file and store the contents as a text string. Here is a code that does just that.
Dim Textstring
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile("File.txt", 1)
Textstring = objText.ReadAll
Dim Textstring
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile("File.txt", 1)
Textstring = objText.ReadAll
STEP 14: Final Exam...
This time take what you have learned from this instructable and write a program by yourself. Comment it so we all can enjoy it.
STEP 15: Bye
Thank you for reading this instructable. Comment anything cool you come up with so we can all share our discoveries.
-Super_Nerd-
-Super_Nerd-
STEP 16: Additional Steps: the String Function "Replace"
mohamadelmoussa asked for a command that would replace certain words with others in text strings. The replace command is definitely, what he was looking for. Here is the basic syntax.
Replace(string,"change this to","this")
Here is an example of using the replace function...
text="This is a good instructable!"
msgbox (Replace(text,"a good","an awesome"))
Thanks for the compliment example.
Replace(string,"change this to","this")
Here is an example of using the replace function...
text="This is a good instructable!"
msgbox (Replace(text,"a good","an awesome"))
Thanks for the compliment example.
46 Comments
edwardteddy30 2 months ago
Should work.
DISCLAMER:this code will open tiktok on chrome
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Do You Want To Delete This Harmful Software? ",4+16,"Mcafee AntiVirus")
variable=msgbox ("Are You Sure?",4+32,"Mcafee AntiVirus")
variable=msgbox ("No Harmful Software Found!",0+64,"Your Computer Is Protected!")
variable=msgbox ("Do You Want To Run A Scan?",4+32,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected!!!! ",0+48,"Mcafee AntiVirus")
variable=msgbox (" ",0+48,"YOUR RANSOMWARE! that you downloaded!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
variable=msgbox (" ",0+48,"YOUR RANSOMWARE! that you downloaded!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
variable=msgbox ("and you have a trogan that can control your computer even if it is off !!!!!!!!!!",0+16,"")
variable=msgbox ("!",0+48,"!")
variable=msgbox ("!",0+48,"!")
variable=msgbox ("!",0+48,"!")
variable=msgbox ("!",0+48,"!")
variable=msgbox ("!",0+48,"!")
variable=msgbox ("if you turn this computer off it will explode and do not play with FAKE macafeeeeeeeeeeeeeeeeeeee!",0+48,"yes you computer will explod")
variable=msgbox ("better throw this out the window because your computer that you spent £900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 on is now screwed up! ha",0+48,"YOUR PC IS R.I.P!")
variable=msgbox ("and you know that you not to play around with MACAFEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",0+48,"")
variable=msgbox ("https://www.youtube.com/watch?v=dQw4w9WgXcQ",0+64,"")
variable=msgbox ("do you want to open that youtube vid?",4+32,"")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("ERROR",0+48,":)")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("",,"")
variable=msgbox ("I HATE PEOPLE CLIKING ON MY TRICK BECAUSE YOU ARE THE MOST UNBEHAVED PERSON ON EARTH",0+16,"I HATE YOU!!!!!!!!!!!!!!!!!!!!!")
variable=msgbox ("infecting you computer with 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 viruses!",0+16,"your computer is now metal!!!!!!!!")
Dim iURL
Dim objShell
iURL = "https://www.tiktok.com/en/"
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", iURL, "", "", 1
Dim wshshell
Function qq(str)
qq = Chr(34) & str & Chr(34)
End Function
FirefoxProfile = "default"
FirefoxPath = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
webappurl = "https://www.google.com"
Height = "700"
Width = "920"
Status ="0"
Toolbar = "0"
Menubar = "0"
Sub Chrome(URL)
'----------------------------------------------------------------------
' Purpose: Launch Chrome
' Arguments: <URL>
'----------------------------------------------------------------------
if (ubound(split(URL," ")) = 0) then
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", URL, "", "", 1
end if
end Sub
Function ProgressMsg( strMessage, strWindowTitle )
' Written by Denis St-Pierre
' Displays a progress message box that the originating script can kill in both 2k and XP
' If StrMessage is blank, take down previous progress message box
' Using 4096 in Msgbox below makes the progress message float on top of things
' CAVEAT: You must have Dim ObjProgressMsg at the top of your script for this to work as described
Set wshShell = CreateObject( "WScript.Shell" )
strTEMP = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
If strMessage = "" Then
' Disable Error Checking in case objProgressMsg doesn't exists yet
On Error Resume Next
' Kill ProgressMsg
objProgressMsg.Terminate( )
' Re-enable Error Checking
On Error Goto 0
Exit Function
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
strTempVBS = strTEMP + "\" & "Message.vbs" 'Control File for reboot
' Create Message.vbs, True=overwrite
Set objTempMessage = objFSO.CreateTextFile( strTempVBS, True )
objTempMessage.WriteLine( "MsgBox""" & strMessage & """, 4096, """ & strWindowTitle & """" )
objTempMessage.Close
' Disable Error Checking in case objProgressMsg doesn't exists yet
On Error Resume Next
' Kills the Previous ProgressMsg
objProgressMsg.Terminate( )
' Re-enable Error Checking
On Error Goto 0
' Trigger objProgressMsg and keep an object on it
Set objProgressMsg = WshShell.Exec( "%windir%\system32\wscript.exe " & strTempVBS )
Set wshShell = Nothing
Set objFSO = Nothing
End Function
variable=msgbox ("is is when tiktok happens likea popopopop MAGICALY but i love soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooosososoososososososoososoososo much hahahhahahahahahha if you don't i love it!!!!!!!!!!!!!",0+16+4096,"TiTok(VIRUS¬!```````````````````````````````````````````````````````¬¬¬¬¬¦¦¦¦¦¦")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected f ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("Viruses Detected f ",0+48,"Mcafee fakkkkke AntiVirus")
variable=msgbox ("Viruses Detected ",0+48,"Mcafee AntiVirus")
variable=msgbox ("this is real` ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` ",0+48,"Mcafee AntiVirus")
Sapi.speak "no system please reset disk"
variable=msgbox ("no system please reset disk ",0+48,"explorer.&$£")
Sapi.speak "no system please reset disk"
variable=msgbox ("no system please reset disk ",0+48,"explorer.&$£")
Sapi.speak "no system please reset disk"
variable=msgbox ("no system please reset disk ",0+48,"explorer.&$£")
variable=msgbox ("NO RAM THIS IS BAD",0+48,"")
variable=msgbox ("123456789",0+16,"123456789")
variable=msgbox ("123456789",0+16,"123456789")
variable=msgbox ("123456789",0+16,"123456789")
msgbox"Hello This Is Mcafee™ Here Your Computer Is In Going To Be Deleted. We Can Not Do Anything About It "
msgbox"We Are Sorry About Your PC But If Your Computer Has Not Been Deleted We Recommend To (If The Computer Has Said Not to shutdown DO NOT)Shutdown The PC If Your Computer Is Connected To A Different Compter Or Device Please DISCONNECT The Device Thanks Mcafee™"
variable=inputbox ("Please Enter Your Email Adress To Comfirm This Is YOUR Account","ANTIVIRUS","@gmail.com")
variable=inputbox ("we have sent a 6 digit code to YOUR Account. ","ANTIVIRUS","")
variable=msgbox ("Wrong try again",0+16,"ANTIVIRUS")
variable=inputbox ("we have sent a 6 digit code to YOUR Account. ","ANTIVIRUS","")
variable=msgbox ("Wrong try again",0+16,"ANTIVIRUS")
i omor 4 months ago
msgbox (Date)
msgbox (Time)
variable=msgbox("out of storage" ,0+0, "window")
variable=msgbox("clear your storage" ,0+0, "window")
variable=msgbox("..." ,0+0, "window")
variable=msgbox("why wont you clear it...?" ,0+0, "window")
variable=msgbox("CLEAR THE STORAGE NOW!!!" ,0+1, "window")
i omor 4 months ago
ummidk 1 year ago
X=inputbox("Your computer has detected a virus in ~\AppData\Roaming, referring to 0x00000000457e. Delete?","Warning","Yes/No")
Y = "Yes"
N = "No"
if X = Y then
Y=MsgBox("SystemError: Cannot perform such task",0+64)
end if
s_kr 1 year ago
if a=6 then
a=MsgBox ("TEXT",0,"TITLE")
else
msgbox "TEXT"
end if
this?
thuglifefrownz 7 years ago
How do you make a quiz, like with the input boxes and using "if then else"
s_kr 1 year ago
if a= "ANSERW" Then
MsgBox "GOOD NEXT ONE"
else
msgbox "BAD"
end if
a=InputBox ("NEXT QUESTION TEXT","NEXT QUESTION TITLE HERE")'
if a= "ANSERW" THEN
msgbox "GOOD"
else
msgbox "BAD"
end if
yeah so here you go!
wilderness tech 7 years ago
What is wrong with my code?
Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.SendKeys "FirstWord"
WScript.Sleep "200"
WshShell.SendKeys "SecondWord"
s_kr 1 year ago
objShell.Run("notepad.exe")
Wscript.sleep "2000"
objShell.SendKeys "First Word"
WScript.Sleep "2000"
objShell.SendKeys "Second Word"
it writes on your desktop you need to open a program first. Like cmd or notepad here is the fixed one, you also need to click the notepad .
1024bit 4 years ago
s_kr 1 year ago
x=msgbox("Your Text Here" ,0+16, "Your Title Here")
if x=1 then
Set a= CreateObject("Wscript.Shell")
objShell.Run("your program here needs to be .exe ")
end if
rappygames 2 years ago
dim password
set wshshell = wscript.CreateObject("wscript.shell")
variable=msgbox ("You need to enter the password second time",0+16+0+4096,"Windows")
password=inputbox ("Enter Password","Windows")
if password = "password" then
msgbox ("Welcome")
else
msgbox ("Access denied")
variable=msgbox ("Logging off",64+4096,"Windows")
wshshell.run "C:\Windows\System32\shutdown.exe -L"
end if
Shrek6641 5 years ago
randomguy400 3 years ago
if variable = "kaitokid" then
msgbox("Allowed access")
else
msgbox("Access is denied!")
end if
nateplayz2020 2 years ago
Dim pass
pass=inputbox("box message","box title","")
if pass = "kaitokid" then
msgbox("Allowed access")
else
msgbox("Access is denied!")
end if
Nickwow. 5 years ago
dim variable
dim variable2
dim variable3
dim variable4
dim variable5
Sapi.speak "hello user. I am so lonely over here. do you want to continue talking to me?"
variable=MsgBox("Do you?",4+64,"Computer")
if variable = vbYes then
Sapi.speak "Ok then. I will continue"
Sapi.speak "Nick always plays games but never opens anything else"
Sapi.speak "Sorry for compaining, but I can't talk to anyone so I am depressed"
Sapi.speak "and sometimes I have some erererererererrorsss"
Sapi.speak "Am I relly a good friend?"
variable4=MsgBox("Am I relly a good friand?",4+64,"Computer")
if variable4 = vbNo then
Sap.speak "So we are not friends"
if variable5 = vbNo then
Sapi.speak "ok I will stop talking"
else
Sapi.speak "ok so we are"
else
Sapi.speak "ok so we are. I have to leave now because I have some work to do"
Sapi.speak "good bye i had a good tine talking with you"
X=MsgBox(":)")
else
Sapi.speak "don't you care about my feelings?"
variable3=MsgBox("...",4+64,"Computer")
if variable3 = vbYes then
Sapi.speak "ok"
else
variable2=MsgBox("You Will regret this",0+16,"Angry Computer")
do
Sapi.speak "error error error error"
X=MsgBox("Error",0+16,"Angry Conmputer")
loop
end if
end if
end if
end if
what is wrong over here?
Tortuga9207 3 years ago
nateplayz2020 2 years ago
nateplayz2020 2 years ago
Code:
Option Explicit
Dim pass
pass = InputBox("ENter the password" , "Check Password")
if pass = "qwerty" then
msgbox ("Valid Password")
else
msgbox ("Invalid Password")
end if
Programer08 5 years ago
variable=inputbox ("Its Virus!",Virus,"Enter Password Here!")
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "I just want to hack you WHY WHY WHY WHY WHY!"
Msgbox "Deleting System32...",0+16,"System32"
Msgbox "Deleting Complete!",2+64,"Microsoft Windows"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "HA HA HA HA HA HA HA HA HA HA"
Msgbox "Deleting usernet.exe",0+16,"This Virus"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "I delete all!"
Msgbox "Deleting all!",2+16,"Anonymous"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "I love it!"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "I HACK YOU NOW!!!!!!!!"
Msgbox "Hacking...",0+64,"Hacker"
Msgbox "Password ***** email *********** username ********"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "HA HA HA HA HA HA HA HA HA"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "Meow Meow Meow Meow!"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "Meow Meow Meow Meow!"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "Meow Meow Meow Meow!"
do
Msgbox "Meow Meow!"
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "Meow Meow Meow Meow!"
loop