SlideShare a Scribd company logo
1 of 35
Kamesh Shekhar Prasad
Topics of Discussion
 Introduction
 VBScript Placement in HTML File
 Reserved Words, Variables, Constants, Operators
 Decisions, Loops
 Events
 Strings
 Arrays
 Functions
 Sub procedures
Introduction
 VBScript stands for Visual Basic Scripting. VBScript was introduced by
Microsoft in 1996.
 Features of VBScript
 Lightweight
 case insensitive
 object-based scripting language
An Example
<html>
<body>
<script language = "vbscript" type =
"text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>
 Output
VBScript Placement in HTML File
We can include VBScript code anywhere in an HTML document. The
most preferred ways are -
• Script in <head>...</head> section.
• Script in <body>...</body> section.
• Script in <body>...</body> and <head>...</head> sections.
• Script in an external file and then include in <head>...</head> section.
Reserved Words
Loop Lset Me
Mod New Next
Not Nothing Null
On Option Optional
Or ParamArray Preserve
Private Public RaiseEvent
ReDim Rem Resume
Rset Select Set
Shared Single Static
Stop Sub Then
To True Type
And As Boolean
ByRef Byte ByVal
Call Case Class
Reserved Words(2)
Const Currency Debug
Dim Do Double
Each Else ElseIf
Empty End EndIf
Enum Eqv Event
Exit False For
Function Get GoTo
If Imp Implements
In Integer Is
Let Like Long
TypeOf Until Variant
Wend While With
Xor Eval Execute
Msgbox Erase ExecuteGlobal
Option Explicit Randomize SendKeys
Variables
A variable is a named memory location used to hold a value that can
be changed during the script execution. VBScript has only ONE fundamental
data type -Variant.
Variables are declared using “dim” (“public”, “private”) keyword.
Dim Variable1
Rules for Declaring Variables −
• Variable Name must begin with an alphabet.
• Variable names cannot exceed 255 characters.
• Variables Should NOT contain a period (.)
• Variable Names should be unique in the declared context.
Constants
Constant is a named memory location used to hold a value that
CANNOT be changed during the script execution.
Syntax
[Public | Private] Const Constant_Name = Value
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
Dim intRadius
intRadius = 20
const pi = 3.14
Area = pi*intRadius*intRadius
Msgbox Area
</script>
</body>
</html>
Operators
VBScript language supports following types of operators −
 Arithmetic Operators
 Comparison Operators
 Logical (or Relational) Operators
 Concatenation Operators
Arithmetic Operators
Operator Description Example
+ Adds two operands A + B will give 15
- Subtracts second operand from the first A - B will give -5
* Multiply both operands A * B will give 50
/ Divide numerator by denumerator B / A will give 2
%
Modulus Operator and remainder of after an
integer division
B MOD A will give
0
^ Exponentiation Operator
B ^ A will give
100000
A=5,B=10
Comparison Operator
Operator Description Example
=
Checks if the value of two operands are equal or not, if
yes then condition becomes true.
(A == B) is False.
<>
Checks if the value of two operands are equal or not, if
values are not equal then condition becomes true.
(A <> B) is True.
>
Checks if the value of left operand is greater than the
value of right operand, if yes then condition becomes true.
(A > B) is False.
<
Checks if the value of left operand is less than the value of
right operand, if yes then condition becomes true.
(A < B) is True.
>=
Checks if the value of left operand is greater than or equal
to the value of right operand, if yes then condition
becomes true.
(A >= B) is False.
<=
Checks if the value of left operand is less than or equal to
the value of right operand, if yes then condition becomes
true.
(A <= B) is True.
A=10,B=20
Logical Operators
Operator Description Example
AND
Called Logical AND operator. If both the conditions are
True, then Expression becomes True.
a<>0 AND b<>0 is
False.
OR
Called Logical OR Operator. If any of the two conditions is
True, then condition becomes True.
a<>0 OR b<>0 is true.
NOT
Called Logical NOT Operator. It reverses the logical state of
its operand. If a condition is True, then the Logical NOT
operator will make it False.
NOT(a<>0 OR b<>0) is
false.
XOR
Called Logical Exclusion. It is the combination of NOT and
OR Operator. If one, and only one, of the expressions
evaluates to True, result is True.
(a<>0 XOR b<>0) is
true.
A=10,B=0
Concatenation Operators
Operator Description Example
+ Adds two Values as Variable Values are Numeric A + B will give 15
& Concatenates two Values A & B will give 510
Operator Description Example
+ Concatenates two Values A + B will give MicrosoftVBScript
& Concatenates two Values A & B will give MicrosoftVBScript
Assume variable A = "Microsoft" and variable B="VBScript", then −
A=5,B=10
Decision Making
Decision making allows programmers to control the execution flow
of a script or one of its sections. The execution is governed by one or
more conditional statements.
Decision Making
Statement Description
if statement
An if statement consists of a Boolean expression followed by
one or more statements.
if..else statement
An if else statement consists of a Boolean expression followed
by one or more statements. If the condition is True, the
statements under the If statements are executed. If the
condition is false, then the Else part of the script is Executed
if...elseif..else statement
An if statement followed by one or more ElseIf Statements,
that consists of Boolean expressions and then followed by an
optional else statement, which executes when all the condition
becomes false.
nested if statements An if or elseif statement inside another if or elseif statement(s).
switch statement
A switch statement allows a variable to be tested for equality
against a list of values.
Loops
Loop Type Description
for loop
Executes a sequence of statements multiple times and
abbreviates the code that manages the loop variable.
for ..each loop
It is executed if there is at least one element in group
and reiterated for each element in a group.
while..wend loop It tests the condition before executing the loop body.
do..while loops
The do..While statements will be executed as long as
condition is True.(i.e.,) The Loop should be repeated till
the condition is False.
do..until loops
The do..Until statements will be executed as long as
condition is False.(i.e.,) The Loop should be repeated
till the condition is True.
Events
 VBScript's interaction with HTML is handled through events that occur
when the user or browser manipulates a page. When the page loads,
that is an event. When the user clicks a button, that click too is an event.
onclick Event Type
 <html>
 <head>
 <script language = "vbscript" type =
"text/vbscript">
 Function sayHello()
 msgbox "Hello World"
 End Function
 </script>
 </head>

 <body>
 <input type = "button" onclick = "sayHello()"
value = "Say Hello"/>
 </body>
 </html>
Event Value Description
onchange script Script runs when the element changes
onsubmit script Script runs when the form is submitted
onreset script Script runs when the form is reset
onblur script Script runs when the element loses
focus
onfocus script Script runs when the element gets focus
onkeydown script Script runs when key is pressed
onkeypress script Script runs when key is pressed and
released
onkeyup script Script runs when key is released
onclick script Script runs when a mouse click
ondblclick script Script runs when a mouse double-click
onmousedown script Script runs when mouse button is
pressed
onmousemove script Script runs when mouse pointer moves
onmouseout script Script runs when mouse pointer moves
out of an element
onmouseover script Script runs when mouse pointer moves
over an element
onmouseup script Script runs when mouse button is
released
Strings
 Strings are a sequence of characters, which can consist of alphabets or
numbers or special characters or all of them.
 Syntax
variablename = "string“
String Functions
There are predefined VBScript String functions, which help the
developers to work with the strings very effectively.
Function Name Description
InStr Returns the first occurrence of the specified substring. Search happens from left to right.
InstrRev Returns the first occurrence of the specified substring. Search happens from Right to Left.
Lcase Returns the lower case of the specified string.
Ucase Returns the Upper case of the specified string.
Left Returns a specific number of characters from the left side of the string.
Right Returns a specific number of characters from the Right side of the string.
Mid Returns a specific number of characters from a string based on the specified parameters.
Ltrim Returns a string after removing the spaces on the left side of the specified string.
Rtrim Returns a string after removing the spaces on the right side of the specified string.
Trim Returns a string value after removing both leading and trailing blank spaces.
Len Returns the length of the given string.
Replace Returns a string after replacing a string with another string.
Space Fills a string with the specified number of spaces.
StrComp Returns an integer value after comparing the two specified strings.
String Returns a String with a specified character the specified number of times.
StrReverse Returns a String after reversing the sequece of the characters of the given string.
Array
 When a series of values is stored in a single variable, then it is known as
an array variable.
 Declaration
Method 1 : Using Dim Dim arr1() ‘ Without Size
Method 2 : Mentioning the Size
Dim arr2(5)’ Declared with size of 5
Method 3 : using 'Array' Parameter
Dim arr3
arr3 = Array("apple","Orange","Grapes")
Multi Dimensional Arrays
 Arrays are not just limited to single dimension and can have a
maximum of 60 dimensions. Two-dimension arrays are the most
commonly used.
Dim arr(2,3)' Which has 3 rows and 4 columns
arr(0,0) = "Apple"
arr(0,1) = "Orange"
arr(0,2) = "Grapes"
arr(0,3) = "pineapple"
arr(1,0) = "cucumber"
arr(1,1) = "beans"
arr(1,2) = "carrot"
arr(1,3) = "tomato"
arr(2,0) = "potato"
arr(2,1) = "sandwitch"
arr(2,2) = "coffee"
arr(2,3) = "nuts"
Date and Time Functions
 VBScript Date and Time Functions helps to convert date and time from
one format to another or to express the date or time value in the format
that suits a specific condition.
Function Description
Date A Function, which returns the current system date
CDate A Function, which converts a given input to Date
DateAdd A Function, which returns a date to which a specified time interval has
been added
DateDiff A Function, which returns the difference between two time period
DatePart A Function, which returns a specified part of the given input date value
DateSerial A Function, which returns a valid date for the given year,month and date
FormatDateTime A Function, which formats the date based on the supplied parameters
Date and Time Functions
Function Description
Now A Function, which returns the current system date and Time
Hour A Function, which returns and integer between 0 and 23 that represents the Hour
part of the the given time
Minute A Function, which returns and integer between 0 and 59 that represents the
Minutes part of the the given time
Second A Function, which returns and integer between 0 and 59 that represents the
Seconds part of the the given time
Time A Function, which returns the current system time
Timer A Function, which returns the number of seconds and milliseconds since 12:00
AM
TimeSerial A Function, which returns the time for the specific input of hour,minute and
second
TimeValue A Function, which converts the input string to a time format
Functions
 A function is a group of reusable code which can be called anywhere in our program.
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
Function Functionname(parameter-list)
statement 1
statement 2
statement 3
.......
statement n
End Function
</script>
</body>
</html>
Syntax to implement function
Functions
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type =
"text/vbscript">
Function sayHello()
msgbox("Hello there")
End Function
</script>
</body>
</html>
Function
 Calling a function
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type =
"text/vbscript">
Function sayHello()
msgbox("Hello there")
End Function
Call sayHello()
</script>
</body>
</html>
Function
 Function Parameters
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type =
"text/vbscript">
Function sayHello(name, age)
msgbox( name & " is " & age & " years
old.")
End Function
Call sayHello(“John", 7)
</script>
</body>
</html>
Sub-procedures
 Sub-Procedures are similar to functions but there are few differences.
 Sub-procedures DONOT Return a value while functions may or may not
return a value.
 Sub-procedures Can be called without call keyword.
 Sub-procedures are always enclosed within Sub and End Sub statements.
Sub-procedures
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type =
"text/vbscript">
Sub sayHello()
msgbox("Hello there")
End Sub
</script>
</body>
</html>
An validation example
 This event occurs when you try to submit a form. So
you can put your form validation against this event
type.
<HTML>
<HEAD><TITLE>Simple Validation</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Submit_OnClick
Dim TheForm
Set TheForm = Document.ValidForm
If IsNumeric(TheForm.Text1.Value) Then
If TheForm.Text1.Value < 1 Or TheForm.Text1.Value > 10
Then
MsgBox "Please enter a number between 1 and 10."
Else
MsgBox "Thank you."
End If
Else
MsgBox "Please enter a numeric value."
End If
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H3>Simple Validation</H3><HR>
<FORM NAME="ValidForm">
Enter a value between 1 and 10:
<INPUT NAME="Text1" TYPE="TEXT" SIZE="2">
<button name="Submit">Submit</button>
</FORM>
</BODY>
</HTML>
An validation example
THANK YOU

More Related Content

What's hot

Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.netJaya Kumari
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#Raghu nath
 
Intorudction into VBScript
Intorudction into VBScriptIntorudction into VBScript
Intorudction into VBScriptVitaliy Ganzha
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script TrainingsAli Imran
 
Variable and constants in Vb.NET
Variable and constants in Vb.NETVariable and constants in Vb.NET
Variable and constants in Vb.NETJaya Kumari
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtpCuong Tran Van
 
Spf Chapter4 Variables
Spf Chapter4 VariablesSpf Chapter4 Variables
Spf Chapter4 VariablesHock Leng PUAH
 
Javascript - Tutorial
Javascript - TutorialJavascript - Tutorial
Javascript - Tutorialadelaticleanu
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++Neeru Mittal
 
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...Mark Simon
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoftch samaram
 
Spf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsSpf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsHock Leng PUAH
 

What's hot (20)

Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
VB Script
VB ScriptVB Script
VB Script
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
 
Vbscript
VbscriptVbscript
Vbscript
 
Intorudction into VBScript
Intorudction into VBScriptIntorudction into VBScript
Intorudction into VBScript
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
 
Variable and constants in Vb.NET
Variable and constants in Vb.NETVariable and constants in Vb.NET
Variable and constants in Vb.NET
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
 
Spf Chapter4 Variables
Spf Chapter4 VariablesSpf Chapter4 Variables
Spf Chapter4 Variables
 
Javascript - Tutorial
Javascript - TutorialJavascript - Tutorial
Javascript - Tutorial
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++
 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
 
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
The Swift Programming Language - Xcode6 for iOS App Development - AgileInfowa...
 
Introducing Swift v2.1
Introducing Swift v2.1Introducing Swift v2.1
Introducing Swift v2.1
 
Learn Java Part 2
Learn Java Part 2Learn Java Part 2
Learn Java Part 2
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Books
BooksBooks
Books
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoft
 
Spf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsSpf Chapter5 Conditional Logics
Spf Chapter5 Conditional Logics
 

Similar to Vb script final pari

C# language basics (Visual Studio)
C# language basics (Visual Studio) C# language basics (Visual Studio)
C# language basics (Visual Studio) rnkhan
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golangwww.ixxo.io
 
Python_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptxPython_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptxSahajShrimal1
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdfvenud11
 
Php intro by sami kz
Php intro by sami kzPhp intro by sami kz
Php intro by sami kzsami2244
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java scriptDivyaKS12
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]srikanthbkm
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScriptDIWE - Programming with JavaScript
DIWE - Programming with JavaScriptRasan Samarasinghe
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A ReviewFernando Torres
 
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfBasic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfComputer Programmer
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statementsSaad Sheikh
 

Similar to Vb script final pari (20)

C# language basics (Visual Studio)
C# language basics (Visual Studio) C# language basics (Visual Studio)
C# language basics (Visual Studio)
 
Vb script tutorial
Vb script tutorialVb script tutorial
Vb script tutorial
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to golang
Introduction to golangIntroduction to golang
Introduction to golang
 
Python_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptxPython_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptx
 
JAVASCRIPT - LinkedIn
JAVASCRIPT - LinkedInJAVASCRIPT - LinkedIn
JAVASCRIPT - LinkedIn
 
Vb script tutorial
Vb script tutorialVb script tutorial
Vb script tutorial
 
1669958779195.pdf
1669958779195.pdf1669958779195.pdf
1669958779195.pdf
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Php intro by sami kz
Php intro by sami kzPhp intro by sami kz
Php intro by sami kz
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
vb.net.pdf
vb.net.pdfvb.net.pdf
vb.net.pdf
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScriptDIWE - Programming with JavaScript
DIWE - Programming with JavaScript
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdfBasic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
Basic_C++ Notes with problema from Preethi arora and suneetha arora.pdf
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Vb script final pari

  • 2. Topics of Discussion  Introduction  VBScript Placement in HTML File  Reserved Words, Variables, Constants, Operators  Decisions, Loops  Events  Strings  Arrays  Functions  Sub procedures
  • 3. Introduction  VBScript stands for Visual Basic Scripting. VBScript was introduced by Microsoft in 1996.  Features of VBScript  Lightweight  case insensitive  object-based scripting language
  • 4. An Example <html> <body> <script language = "vbscript" type = "text/vbscript"> document.write("Hello World!") </script> </body> </html>  Output
  • 5. VBScript Placement in HTML File We can include VBScript code anywhere in an HTML document. The most preferred ways are - • Script in <head>...</head> section. • Script in <body>...</body> section. • Script in <body>...</body> and <head>...</head> sections. • Script in an external file and then include in <head>...</head> section.
  • 6. Reserved Words Loop Lset Me Mod New Next Not Nothing Null On Option Optional Or ParamArray Preserve Private Public RaiseEvent ReDim Rem Resume Rset Select Set Shared Single Static Stop Sub Then To True Type And As Boolean ByRef Byte ByVal Call Case Class
  • 7. Reserved Words(2) Const Currency Debug Dim Do Double Each Else ElseIf Empty End EndIf Enum Eqv Event Exit False For Function Get GoTo If Imp Implements In Integer Is Let Like Long TypeOf Until Variant Wend While With Xor Eval Execute Msgbox Erase ExecuteGlobal Option Explicit Randomize SendKeys
  • 8. Variables A variable is a named memory location used to hold a value that can be changed during the script execution. VBScript has only ONE fundamental data type -Variant. Variables are declared using “dim” (“public”, “private”) keyword. Dim Variable1 Rules for Declaring Variables − • Variable Name must begin with an alphabet. • Variable names cannot exceed 255 characters. • Variables Should NOT contain a period (.) • Variable Names should be unique in the declared context.
  • 9. Constants Constant is a named memory location used to hold a value that CANNOT be changed during the script execution. Syntax [Public | Private] Const Constant_Name = Value <html> <body> <script language = "vbscript" type = "text/vbscript"> Dim intRadius intRadius = 20 const pi = 3.14 Area = pi*intRadius*intRadius Msgbox Area </script> </body> </html>
  • 10. Operators VBScript language supports following types of operators −  Arithmetic Operators  Comparison Operators  Logical (or Relational) Operators  Concatenation Operators
  • 11. Arithmetic Operators Operator Description Example + Adds two operands A + B will give 15 - Subtracts second operand from the first A - B will give -5 * Multiply both operands A * B will give 50 / Divide numerator by denumerator B / A will give 2 % Modulus Operator and remainder of after an integer division B MOD A will give 0 ^ Exponentiation Operator B ^ A will give 100000 A=5,B=10
  • 12. Comparison Operator Operator Description Example = Checks if the value of two operands are equal or not, if yes then condition becomes true. (A == B) is False. <> Checks if the value of two operands are equal or not, if values are not equal then condition becomes true. (A <> B) is True. > Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is False. < Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (A < B) is True. >= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (A >= B) is False. <= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (A <= B) is True. A=10,B=20
  • 13. Logical Operators Operator Description Example AND Called Logical AND operator. If both the conditions are True, then Expression becomes True. a<>0 AND b<>0 is False. OR Called Logical OR Operator. If any of the two conditions is True, then condition becomes True. a<>0 OR b<>0 is true. NOT Called Logical NOT Operator. It reverses the logical state of its operand. If a condition is True, then the Logical NOT operator will make it False. NOT(a<>0 OR b<>0) is false. XOR Called Logical Exclusion. It is the combination of NOT and OR Operator. If one, and only one, of the expressions evaluates to True, result is True. (a<>0 XOR b<>0) is true. A=10,B=0
  • 14. Concatenation Operators Operator Description Example + Adds two Values as Variable Values are Numeric A + B will give 15 & Concatenates two Values A & B will give 510 Operator Description Example + Concatenates two Values A + B will give MicrosoftVBScript & Concatenates two Values A & B will give MicrosoftVBScript Assume variable A = "Microsoft" and variable B="VBScript", then − A=5,B=10
  • 15. Decision Making Decision making allows programmers to control the execution flow of a script or one of its sections. The execution is governed by one or more conditional statements.
  • 16. Decision Making Statement Description if statement An if statement consists of a Boolean expression followed by one or more statements. if..else statement An if else statement consists of a Boolean expression followed by one or more statements. If the condition is True, the statements under the If statements are executed. If the condition is false, then the Else part of the script is Executed if...elseif..else statement An if statement followed by one or more ElseIf Statements, that consists of Boolean expressions and then followed by an optional else statement, which executes when all the condition becomes false. nested if statements An if or elseif statement inside another if or elseif statement(s). switch statement A switch statement allows a variable to be tested for equality against a list of values.
  • 17. Loops Loop Type Description for loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. for ..each loop It is executed if there is at least one element in group and reiterated for each element in a group. while..wend loop It tests the condition before executing the loop body. do..while loops The do..While statements will be executed as long as condition is True.(i.e.,) The Loop should be repeated till the condition is False. do..until loops The do..Until statements will be executed as long as condition is False.(i.e.,) The Loop should be repeated till the condition is True.
  • 18. Events  VBScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is an event. When the user clicks a button, that click too is an event.
  • 19. onclick Event Type  <html>  <head>  <script language = "vbscript" type = "text/vbscript">  Function sayHello()  msgbox "Hello World"  End Function  </script>  </head>   <body>  <input type = "button" onclick = "sayHello()" value = "Say Hello"/>  </body>  </html>
  • 20. Event Value Description onchange script Script runs when the element changes onsubmit script Script runs when the form is submitted onreset script Script runs when the form is reset onblur script Script runs when the element loses focus onfocus script Script runs when the element gets focus onkeydown script Script runs when key is pressed onkeypress script Script runs when key is pressed and released onkeyup script Script runs when key is released onclick script Script runs when a mouse click ondblclick script Script runs when a mouse double-click onmousedown script Script runs when mouse button is pressed onmousemove script Script runs when mouse pointer moves onmouseout script Script runs when mouse pointer moves out of an element onmouseover script Script runs when mouse pointer moves over an element onmouseup script Script runs when mouse button is released
  • 21. Strings  Strings are a sequence of characters, which can consist of alphabets or numbers or special characters or all of them.  Syntax variablename = "string“ String Functions There are predefined VBScript String functions, which help the developers to work with the strings very effectively.
  • 22. Function Name Description InStr Returns the first occurrence of the specified substring. Search happens from left to right. InstrRev Returns the first occurrence of the specified substring. Search happens from Right to Left. Lcase Returns the lower case of the specified string. Ucase Returns the Upper case of the specified string. Left Returns a specific number of characters from the left side of the string. Right Returns a specific number of characters from the Right side of the string. Mid Returns a specific number of characters from a string based on the specified parameters. Ltrim Returns a string after removing the spaces on the left side of the specified string. Rtrim Returns a string after removing the spaces on the right side of the specified string. Trim Returns a string value after removing both leading and trailing blank spaces. Len Returns the length of the given string. Replace Returns a string after replacing a string with another string. Space Fills a string with the specified number of spaces. StrComp Returns an integer value after comparing the two specified strings. String Returns a String with a specified character the specified number of times. StrReverse Returns a String after reversing the sequece of the characters of the given string.
  • 23. Array  When a series of values is stored in a single variable, then it is known as an array variable.  Declaration Method 1 : Using Dim Dim arr1() ‘ Without Size Method 2 : Mentioning the Size Dim arr2(5)’ Declared with size of 5 Method 3 : using 'Array' Parameter Dim arr3 arr3 = Array("apple","Orange","Grapes")
  • 24. Multi Dimensional Arrays  Arrays are not just limited to single dimension and can have a maximum of 60 dimensions. Two-dimension arrays are the most commonly used. Dim arr(2,3)' Which has 3 rows and 4 columns arr(0,0) = "Apple" arr(0,1) = "Orange" arr(0,2) = "Grapes" arr(0,3) = "pineapple" arr(1,0) = "cucumber" arr(1,1) = "beans" arr(1,2) = "carrot" arr(1,3) = "tomato" arr(2,0) = "potato" arr(2,1) = "sandwitch" arr(2,2) = "coffee" arr(2,3) = "nuts"
  • 25. Date and Time Functions  VBScript Date and Time Functions helps to convert date and time from one format to another or to express the date or time value in the format that suits a specific condition. Function Description Date A Function, which returns the current system date CDate A Function, which converts a given input to Date DateAdd A Function, which returns a date to which a specified time interval has been added DateDiff A Function, which returns the difference between two time period DatePart A Function, which returns a specified part of the given input date value DateSerial A Function, which returns a valid date for the given year,month and date FormatDateTime A Function, which formats the date based on the supplied parameters
  • 26. Date and Time Functions Function Description Now A Function, which returns the current system date and Time Hour A Function, which returns and integer between 0 and 23 that represents the Hour part of the the given time Minute A Function, which returns and integer between 0 and 59 that represents the Minutes part of the the given time Second A Function, which returns and integer between 0 and 59 that represents the Seconds part of the the given time Time A Function, which returns the current system time Timer A Function, which returns the number of seconds and milliseconds since 12:00 AM TimeSerial A Function, which returns the time for the specific input of hour,minute and second TimeValue A Function, which converts the input string to a time format
  • 27. Functions  A function is a group of reusable code which can be called anywhere in our program. <!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Function Functionname(parameter-list) statement 1 statement 2 statement 3 ....... statement n End Function </script> </body> </html> Syntax to implement function
  • 28. Functions <!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Function sayHello() msgbox("Hello there") End Function </script> </body> </html>
  • 29. Function  Calling a function <!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Function sayHello() msgbox("Hello there") End Function Call sayHello() </script> </body> </html>
  • 30. Function  Function Parameters <!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Function sayHello(name, age) msgbox( name & " is " & age & " years old.") End Function Call sayHello(“John", 7) </script> </body> </html>
  • 31. Sub-procedures  Sub-Procedures are similar to functions but there are few differences.  Sub-procedures DONOT Return a value while functions may or may not return a value.  Sub-procedures Can be called without call keyword.  Sub-procedures are always enclosed within Sub and End Sub statements.
  • 32. Sub-procedures <!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Sub sayHello() msgbox("Hello there") End Sub </script> </body> </html>
  • 33. An validation example  This event occurs when you try to submit a form. So you can put your form validation against this event type. <HTML> <HEAD><TITLE>Simple Validation</TITLE> <SCRIPT LANGUAGE="VBScript"> <!-- Sub Submit_OnClick Dim TheForm Set TheForm = Document.ValidForm If IsNumeric(TheForm.Text1.Value) Then If TheForm.Text1.Value < 1 Or TheForm.Text1.Value > 10 Then MsgBox "Please enter a number between 1 and 10." Else MsgBox "Thank you." End If Else MsgBox "Please enter a numeric value." End If End Sub --> </SCRIPT> </HEAD> <BODY> <H3>Simple Validation</H3><HR> <FORM NAME="ValidForm"> Enter a value between 1 and 10: <INPUT NAME="Text1" TYPE="TEXT" SIZE="2"> <button name="Submit">Submit</button> </FORM> </BODY> </HTML>