You are not logged in.
Pages: 1
Here are some simple VBScript programs.
Note: I originally had a detailed explanation for each one but this page suddenly reloaded and I don't want to retype everything . I'll update it later. Also, the size of the message sending input box is different from the viewing message box, so sorry if there are single quotes for new lines of comments where they aren't supposed to be and if one line spills into the other.
'These are comments in VBScript
'Strings must be in double quotes "" not single quotes ' '
'1. Msgbox
x=msgbox("Hi there", 1, "Title")
'Note: The 1 is a number that denotes the type of msgbox. It can also be some non-string text, such as vbYesNo. 'Please google it for more info
'2. Inputbox
x=inputbox("question/text", "title")
'3. Quiz with if else Elseif
a=inputbox("type yes or no for yes and maybe for no, case-sensitive", "Quiz")
dim score : score = 0
'Create a variable and define a value
if a="yes" or a="no" then
j=msgbox "yes"
score = score+1
'Set score = score+1 also works
elseif a="maybe" then
k=msgbox "no"
else
l=msgbox "I don't understand."
'Extra: Looping
dim var : var = 0
do until var = 11
x=msgbox(var, "loop")
loop
'Warning: the following is an infinite loop. In some cases it can be stopped from the task manager, in some cases 'you will have to shutdown and restart your computer
do
message=msgbox("infinite loop", "title: infinite loop"
loop
Tell me if anything is wrong.
Last edited by pi_cubed (2020-07-03 03:18:20)
pi³
Offline
Pages: 1