VBScript: An Easy & Funny Scripting LanguageI am Rajdip Saha
& I am Going To Teach You How To Do VBScripting. Well I Gonna
Make You A VBScript Expert.
What is VBScript?It is a scripting language. The main platform
in which you can programme it is notepad. From my experience I can
tell you that it is quite easy. Its proof is that I am only of 13
years & I learned the whole script. I think this example was
enough for you to understand how easy is VBScripting. Scripting
language means a small programming language. VBScript is the
language used in ASP (Active Server Pages). It is the primary stage
of Microsofts Visual Basic. It is basically a web script. But being
a web script it is used for many kinds of things. VBScript is used
as a server-side scripting language. It isnotin browser .You cannot
see coding in a browser because the scripts are executed on the
server. The web pages you see are the output from ASP that is
normal HTML. So, I am going to teach you the hidden coding of
VBScript & I will make sure that you will find it easy. I am
sure that you will enjoy the tutorial. Cant wait to learn? Ok, so
lets come to the main topic.Dear Learner, if you find it
interesting then please, comment & like.You can click here to
add a like or comment.Basics of VBScriptOk so lets get ready to
rockHere are the basicsYou will just need notepad only to programme
VBScript. These are written on notepad and then saved with .vbs
extentension. This means that we should save this as anyname.vbs .
To do this just write .vbs on the place of .txt & then save
it.
Do You Know About Variables In Algebra? Something like, x=8,
a=13The letter in the above expression (like x or a) are used to
store value (like 8).These letters are calledvariables, and these
can be used to store value.As with algebra, VBScript variables are
used to hold values or expressions.A variable can have a short
letter like a or a more descriptive name, like bumble.But this has
some different rules like:i) They must begin with a letterii) They
cannot have more than 255 charactersiii) They cannot contain a
period. Like (.)In VBScript, all variables are of typevariant that
can store different types of data.You can also declare a variants
(variable) value using = sign. Like thisExample: Bumble= Msgbox
(Honey)In the above case Bumble is the variable, Honey is the
message which will appear & we are using a = sign to declare
the value of Bumble (variable). We can also see in the above
example a word written as Msgbox this is used to create a message
box in which a specific message will appear.There are also other
boxes like: Inputbox these are used to create a box in which we can
input any statement. To create it just write Inputbox in the place
of Msgbox.*Please Dont Copy Paste These Codes To Notepad. If You
Want To Try Them Then Please Write It In Notepad. Dont Copy Paste
It. Otherwise The Codes Will Not Run.Example: Dim Bumble
Bumble=Inputbox (Honey)To make a variant Dim is used.Example: Dim
Bumble Bumble=Msgbox (Honey)
In this case a dialog box will appear on the screen in which the
word Honey will be written.You can use variants easily.As: Dim
bumble Bumble=Msgbox (Honey) Dim rumble Rumble=Msgbox (Hey &
Bumble)It will show Hey Honey because of &. Array VariablesIt
is used to store multiple values in a single variant (variable). An
example is shown below: Example: Dim Bumbles(3) Bumbles(0)=Msgbox
(Yo) Bumbles(1)=Msgbox (Po) Bumbles(2)=Msgbox (Bo)
Bumbles(3)=Msgbox (Go)The number shown in the bracket is 3.
VBScript recognises zero so this array contains 4 elements (From 0
to 3). This is a fixed-size array. You can assign data to each of
the elements of the array.You can have maximum to 60 dimensions in
an array. Multiple dimensions are declared by separating the
numbers in the brackets with commas like: Dim Table(3,7).Sub
ProceduresA Sub procedure is a series of statements, enclosed by
the Sub and End Sub statements can perform actions, butdoes not
returna value can take arguments. Like This:Sub Mysub()Some script
what you want...End OrSub Mysub(argument1,argument2)Some script
what you want...End VBScript Function ProceduresA Function
procedure is a series of statements, enclosed by the Function and
End Function statements. It can perform actions andcan returna
value. It can take arguments that are passed to it by a calling
procedure without arguments, must include an empty set of brackets
(). It returns a value by assigning a value to its nameExample:
Function Myfunction() Some script what you want... Myfunction=some
value End FunctionOr Function Myfunction() Some script what you
want... Myfunction=some value End FunctionEasy Explanation of
Functions: See This Picture:
Codes Used: Function times(x,y) times = x * y End Function
Dim result dim var1
result = times(10,10)
var1=MsgBox(result)This would give you100Let me explain....You
told it to times 10 by 10...Result = time(10,10)This went to the
functiontimes
x is now 10 and y is now 10So:x * yreturn value with
answer.WoooHooooo You have already learned half of it. So you can
be called as a Half-Programmer right now. Ok Ok Lets learn
more...If, Then & ElseUse the If...Then...Else statement if you
want to execute some code if a condition is true or to select one
of two blocks of code to execute.If you want to execute
onlyonestatement when a condition is true, you can write the code
on one line:If i