SlideShare a Scribd company logo
QTP โ€“ VB Scripting
What is VBScript?
What is VBScript?
โ€ขVBScript is a scripting language
โ€ขA scripting language is a lightweight programming language
โ€ขVBScript is a light version of Microsoft's programming language Visual Basic
โ€ขVBScript is the default language in ASP (Active Server Pages)
VBScript Variables
VBScript variables are used to hold values or expressions.
A variable can have a short name, like x, or a more descriptive name, like carname.
Rules for VBScript variable names:
-> Must begin with a letter
-> Cannot contain a period (.)
-> Cannot exceed 255 characters
In VBScript, all variables are of type variant, that can store different types of data.
VBScript Variables
Declaring (Creating) VBScript Variables
Dim x
Dim carname
Assigning Values to Variables
carname="Volvo"
VBScript Arrays
An array variable is used to store multiple values in a single variable.
Creating Arrays in VB Scripting
Dim names(2)
Adding values into an Array :
names(0)="Tove"
names(1)="Jani"
names(2)="Stale"
Reading Values from an Array :
mother=names(0)
Creating Two Dimensional Array
Dim names(2,2)
Adding values into an Array :
names(0,0)="Tove"
names(0,1)="Jani"
names(1,0)="Stale"
names(1,0)="Stale"
Reading Values from an Array :
mother=names(0,0)
VB - Option Explicit
Option Explicit
Dim carname
carname=some value
This statement forces you to declare all your variables with the dim
If you misspell for example the "carname" variable to "carnime", the script will automatically create a
new variable called "carnime".
To prevent your script from doing this, you can use the Option Explicit statement.
VB - Functions
A Function procedure:
โ€ขis a series of statements, enclosed by the Function and End Function statements
โ€ขcan perform actions and can return a value
โ€ขcan take arguments that are passed to it by a calling procedure
โ€ขwithout arguments, must include an empty set of parentheses ()
โ€ขreturns a value by assigning a value to its name
Syntax for Creating Functions:
function myfunction(A, B)
myfunction= A + B
end function
Syntax for Calling Function:
Call myfunction(argument)
VB - Sub procedure
A Sub procedure:
โ€ขis a series of statements, enclosed by the Sub and End Sub statements
โ€ขcan perform actions, but does not return a value
โ€ขcan take arguments
Example :
Sub mysub(argument1,argument2)
some statements
End Sub
Syntax for Calling Sub:
Mysub argument
VB โ€“ Conditional Statements
Conditional statements are used to perform different actions for different decisions.
In VBScript we have four conditional statements:
โ€ขIf statement - executes a set of code when a condition is true
โ€ขIf...Then...Else statement - select one of two sets of lines to execute
โ€ขIf...Then...ElseIf statement - select one of many sets of lines to execute
โ€ขSelect Case statement - select one of many sets of lines to execute
VB โ€“ Conditional Statements
Syntax If Statement :
If i = 10 Then
some statements
ElseIf i = 11 Then
some statements
ElseIf i = 12 Then
some statements
Else
some statements
End If
Syntax Select Statement:
Select Case d
Case 1
some statements
Case 2
some statements
Case else
some statements
End Select
VB โ€“ Looping Statements
Looping statements are used to run the same block of code a specified number of times.
In VBScript we have four looping statements:
โ€ขFor...Next statement - runs code a specified number of times
โ€ขFor Each...Next statement - runs code for each item in a collection or each element of an array
โ€ขDo...Loop statement - loops while or until a condition is true
โ€ขWhile...Wend statement - Do not use it - use the Do...Loop statement instead
VB โ€“ Looping Statements
Syntax for Loop:
For i=2 To 10
some code
Next
Exit a For...Next
You can exit a For...Next statement with the Exit For keyword.
For i=1 To 10
If i=5 Then
some code
Exit For
End If
Next
VB โ€“ String Functions
Function Description
InStr Returns the position of the first occurrence of one string within another. The search begins at
the first character of the string
InStrRev Returns the position of the first occurrence of one string within another. The search begins at
the last character of the string
LCase Converts a specified string to lowercase
Left Returns a specified number of characters from the left side of a string
Len Returns the number of characters in a string
LTrim Removes spaces on the left side of a string
RTrim Removes spaces on the right side of a string
Trim Removes spaces on both the left and the right side of a string
VB โ€“ String Functions
Mid Returns a specified number of characters from a string
Replace Replaces a specified part of a string with another string a specified number of times
Right Returns a specified number of characters from the right side of a string
Space Returns a string that consists of a specified number of spaces
StrComp Compares two strings and returns a value that represents the result of the comparison
String Returns a string that contains a repeating character of a specified length
StrReverse Reverses a string
UCase Converts a specified string to uppercase
VB โ€“ Array Functions
Function Description
Array Returns a variant containing an array
Filter Returns a zero-based array that contains a subset of a string array based on a filter
criteria
IsArray Returns a Boolean value that indicates whether a specified variable is an array
Join Returns a string that consists of a number of substrings in an array
LBound Returns the smallest subscript for the indicated dimension of an array
Split Returns a zero-based, one-dimensional array that contains a specified number of
substrings
UBound Returns the largest subscript for the indicated dimension of an array
VB โ€“ Date Functions
Function Description
CDate Converts a valid date and time expression to the variant of subtype Date
Date Returns the current system date
DateAdd Returns a date to which a specified time interval has been added
Day Returns a number that represents the day of the month (between 1 and 31,
inclusive)
FormatDateTime Returns an expression formatted as a date or time
Hour Returns a number that represents the hour of the day (between 0 and 23,
inclusive)
IsDate Returns a Boolean value that indicates if the evaluated expression can be
converted to a date
VB โ€“ Date Functions
Minute Returns a number that represents the minute of the hour (between 0 and 59,
inclusive)
Month Returns a number that represents the month of the year (between 1 and 12, inclusive)
MonthName Returns the name of a specified month
Now Returns the current system date and time
Second Returns a number that represents the second of the minute (between 0 and 59,
inclusive)
Time Returns the current system time
TimeValue Returns a time
Weekday Returns a number that represents the day of the week (between 1 and 7, inclusive)
Year Returns a number that represents the year

More Related Content

What's hot

String in c programming
String in c programmingString in c programming
String in c programming
Devan Thakur
ย 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programming
Appili Vamsi Krishna
ย 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
Dattatray Gandhmal
ย 
String.ppt
String.pptString.ppt
String.ppt
ajeela mushtaq
ย 
String functions in C
String functions in CString functions in C
C string
C stringC string
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
Aliul Kadir Akib
ย 
Strings in c language
Strings in  c languageStrings in  c language
Strings in c language
Infinity Tech Solutions
ย 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
Manzoor ALam
ย 
String C Programming
String C ProgrammingString C Programming
String C Programming
Prionto Abdullah
ย 
C programming - String
C programming - StringC programming - String
C programming - String
Achyut Devkota
ย 
Strings IN C
Strings IN CStrings IN C
Strings IN C
yndaravind
ย 
String in c
String in cString in c
String in c
Suneel Dogra
ย 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
Knoldus Inc.
ย 
Chapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements iiChapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements ii
allyn joy calcaben
ย 
Assembly Language String Chapter
Assembly Language String Chapter Assembly Language String Chapter
Assembly Language String Chapter
Atieq-ur -Rehman
ย 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
Samsil Arefin
ย 
Implementation Of String Functions In C
Implementation Of String Functions In CImplementation Of String Functions In C
Implementation Of String Functions In C
Fazila Sadia
ย 
Manipulating strings
Manipulating stringsManipulating strings
Manipulating strings
Jancypriya M
ย 
Strings
StringsStrings
Strings
Mitali Chugh
ย 

What's hot (20)

String in c programming
String in c programmingString in c programming
String in c programming
ย 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programming
ย 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
ย 
String.ppt
String.pptString.ppt
String.ppt
ย 
String functions in C
String functions in CString functions in C
String functions in C
ย 
C string
C stringC string
C string
ย 
Operation on string presentation
Operation on string presentationOperation on string presentation
Operation on string presentation
ย 
Strings in c language
Strings in  c languageStrings in  c language
Strings in c language
ย 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
ย 
String C Programming
String C ProgrammingString C Programming
String C Programming
ย 
C programming - String
C programming - StringC programming - String
C programming - String
ย 
Strings IN C
Strings IN CStrings IN C
Strings IN C
ย 
String in c
String in cString in c
String in c
ย 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
ย 
Chapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements iiChapter 7 expressions and assignment statements ii
Chapter 7 expressions and assignment statements ii
ย 
Assembly Language String Chapter
Assembly Language String Chapter Assembly Language String Chapter
Assembly Language String Chapter
ย 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
ย 
Implementation Of String Functions In C
Implementation Of String Functions In CImplementation Of String Functions In C
Implementation Of String Functions In C
ย 
Manipulating strings
Manipulating stringsManipulating strings
Manipulating strings
ย 
Strings
StringsStrings
Strings
ย 

Viewers also liked

Learn VbScript -String Functions
Learn VbScript -String FunctionsLearn VbScript -String Functions
Learn VbScript -String Functions
Nilanjan Saha
ย 
vbscripting
vbscriptingvbscripting
vbscripting
Anand Dhana
ย 
Vb script reference
Vb script referenceVb script reference
Vb script reference
Pragya Rastogi
ย 
VBScript Tutorial
VBScript TutorialVBScript Tutorial
VBScript Tutorial
Leminy
ย 
Vb script
Vb scriptVb script
Vb script
mcatahir947
ย 
vb script
vb scriptvb script
vb script
Anand Dhana
ย 
Intorudction into VBScript
Intorudction into VBScriptIntorudction into VBScript
Intorudction into VBScript
Vitaliy Ganzha
ย 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1
Umar Ali
ย 
VB Script
VB ScriptVB Script
VB Script
Satish Sukumaran
ย 

Viewers also liked (9)

Learn VbScript -String Functions
Learn VbScript -String FunctionsLearn VbScript -String Functions
Learn VbScript -String Functions
ย 
vbscripting
vbscriptingvbscripting
vbscripting
ย 
Vb script reference
Vb script referenceVb script reference
Vb script reference
ย 
VBScript Tutorial
VBScript TutorialVBScript Tutorial
VBScript Tutorial
ย 
Vb script
Vb scriptVb script
Vb script
ย 
vb script
vb scriptvb script
vb script
ย 
Intorudction into VBScript
Intorudction into VBScriptIntorudction into VBScript
Intorudction into VBScript
ย 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1
ย 
VB Script
VB ScriptVB Script
VB Script
ย 

Similar to Qtp vb scripting

Vb script final pari
Vb script final pariVb script final pari
Vb script final pari
Kamesh Shekhar Prasad
ย 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
Cuong Tran Van
ย 
7400354 vbscript-in-qtp
7400354 vbscript-in-qtp7400354 vbscript-in-qtp
7400354 vbscript-in-qtp
Bharath003
ย 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
Vizwik
ย 
Vbscript
VbscriptVbscript
Vbscript
Abhishek Kesharwani
ย 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
Ralph Weber
ย 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
Praveen Gorantla
ย 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
KennyPratheepKumar
ย 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
BlackRabbitCoder
ย 
VBScript in Software Testing
VBScript in Software TestingVBScript in Software Testing
VBScript in Software Testing
Fayis-QA
ย 
Vb script tutorial
Vb script tutorialVb script tutorial
Vb script tutorial
Abhishek Kesharwani
ย 
From UML/OCL to natural language (using SBVR as pivot)
From UML/OCL to natural language (using SBVR as pivot)From UML/OCL to natural language (using SBVR as pivot)
From UML/OCL to natural language (using SBVR as pivot)
Jordi Cabot
ย 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
Ramu Palanki
ย 
C# language basics (Visual Studio)
C# language basics (Visual Studio) C# language basics (Visual Studio)
C# language basics (Visual Studio)
rnkhan
ย 
C# language basics (Visual studio)
C# language basics (Visual studio)C# language basics (Visual studio)
C# language basics (Visual studio)
rnkhan
ย 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
PriyadarshiniS28
ย 
12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp
sharvivek
ย 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginners
Abishek Purushothaman
ย 
JavaScript โ€“ ECMAScript Basics By Satyen
JavaScript โ€“ ECMAScript Basics By SatyenJavaScript โ€“ ECMAScript Basics By Satyen
JavaScript โ€“ ECMAScript Basics By Satyen
Satyen Pandya
ย 
Variable and constants in Vb.NET
Variable and constants in Vb.NETVariable and constants in Vb.NET
Variable and constants in Vb.NET
Jaya Kumari
ย 

Similar to Qtp vb scripting (20)

Vb script final pari
Vb script final pariVb script final pari
Vb script final pari
ย 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
ย 
7400354 vbscript-in-qtp
7400354 vbscript-in-qtp7400354 vbscript-in-qtp
7400354 vbscript-in-qtp
ย 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
ย 
Vbscript
VbscriptVbscript
Vbscript
ย 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
ย 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
ย 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
ย 
Of Lambdas and LINQ
Of Lambdas and LINQOf Lambdas and LINQ
Of Lambdas and LINQ
ย 
VBScript in Software Testing
VBScript in Software TestingVBScript in Software Testing
VBScript in Software Testing
ย 
Vb script tutorial
Vb script tutorialVb script tutorial
Vb script tutorial
ย 
From UML/OCL to natural language (using SBVR as pivot)
From UML/OCL to natural language (using SBVR as pivot)From UML/OCL to natural language (using SBVR as pivot)
From UML/OCL to natural language (using SBVR as pivot)
ย 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
ย 
C# language basics (Visual Studio)
C# language basics (Visual Studio) C# language basics (Visual Studio)
C# language basics (Visual Studio)
ย 
C# language basics (Visual studio)
C# language basics (Visual studio)C# language basics (Visual studio)
C# language basics (Visual studio)
ย 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
ย 
12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp
ย 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginners
ย 
JavaScript โ€“ ECMAScript Basics By Satyen
JavaScript โ€“ ECMAScript Basics By SatyenJavaScript โ€“ ECMAScript Basics By Satyen
JavaScript โ€“ ECMAScript Basics By Satyen
ย 
Variable and constants in Vb.NET
Variable and constants in Vb.NETVariable and constants in Vb.NET
Variable and constants in Vb.NET
ย 

Recently uploaded

MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
ย 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
ย 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
ย 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
ย 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
ย 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
ย 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
ย 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
ย 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
ย 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
ย 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
ย 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
ย 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
ย 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
ย 
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdfู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ
ย 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
ย 
Bossa Nโ€™ Roll Records by Ismael Vazquez.
Bossa Nโ€™ Roll Records by Ismael Vazquez.Bossa Nโ€™ Roll Records by Ismael Vazquez.
Bossa Nโ€™ Roll Records by Ismael Vazquez.
IsmaelVazquez38
ย 

Recently uploaded (20)

MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
ย 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
ย 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
ย 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
ย 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
ย 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
ย 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
ย 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
ย 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
ย 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
ย 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
ย 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
ย 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
ย 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
ย 
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdfู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ   ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ู…ุตุญู ุงู„ู‚ุฑุงุกุงุช ุงู„ุนุดุฑ ุฃุนุฏ ุฃุญุฑู ุงู„ุฎู„ุงู ุณู…ูŠุฑ ุจุณูŠูˆู†ูŠ.pdf
ย 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
ย 
Bossa Nโ€™ Roll Records by Ismael Vazquez.
Bossa Nโ€™ Roll Records by Ismael Vazquez.Bossa Nโ€™ Roll Records by Ismael Vazquez.
Bossa Nโ€™ Roll Records by Ismael Vazquez.
ย 

Qtp vb scripting

  • 1. QTP โ€“ VB Scripting
  • 2. What is VBScript? What is VBScript? โ€ขVBScript is a scripting language โ€ขA scripting language is a lightweight programming language โ€ขVBScript is a light version of Microsoft's programming language Visual Basic โ€ขVBScript is the default language in ASP (Active Server Pages)
  • 3. VBScript Variables VBScript variables are used to hold values or expressions. A variable can have a short name, like x, or a more descriptive name, like carname. Rules for VBScript variable names: -> Must begin with a letter -> Cannot contain a period (.) -> Cannot exceed 255 characters In VBScript, all variables are of type variant, that can store different types of data.
  • 4. VBScript Variables Declaring (Creating) VBScript Variables Dim x Dim carname Assigning Values to Variables carname="Volvo"
  • 5. VBScript Arrays An array variable is used to store multiple values in a single variable. Creating Arrays in VB Scripting Dim names(2) Adding values into an Array : names(0)="Tove" names(1)="Jani" names(2)="Stale" Reading Values from an Array : mother=names(0) Creating Two Dimensional Array Dim names(2,2) Adding values into an Array : names(0,0)="Tove" names(0,1)="Jani" names(1,0)="Stale" names(1,0)="Stale" Reading Values from an Array : mother=names(0,0)
  • 6. VB - Option Explicit Option Explicit Dim carname carname=some value This statement forces you to declare all your variables with the dim If you misspell for example the "carname" variable to "carnime", the script will automatically create a new variable called "carnime". To prevent your script from doing this, you can use the Option Explicit statement.
  • 7. VB - Functions A Function procedure: โ€ขis a series of statements, enclosed by the Function and End Function statements โ€ขcan perform actions and can return a value โ€ขcan take arguments that are passed to it by a calling procedure โ€ขwithout arguments, must include an empty set of parentheses () โ€ขreturns a value by assigning a value to its name Syntax for Creating Functions: function myfunction(A, B) myfunction= A + B end function Syntax for Calling Function: Call myfunction(argument)
  • 8. VB - Sub procedure A Sub procedure: โ€ขis a series of statements, enclosed by the Sub and End Sub statements โ€ขcan perform actions, but does not return a value โ€ขcan take arguments Example : Sub mysub(argument1,argument2) some statements End Sub Syntax for Calling Sub: Mysub argument
  • 9. VB โ€“ Conditional Statements Conditional statements are used to perform different actions for different decisions. In VBScript we have four conditional statements: โ€ขIf statement - executes a set of code when a condition is true โ€ขIf...Then...Else statement - select one of two sets of lines to execute โ€ขIf...Then...ElseIf statement - select one of many sets of lines to execute โ€ขSelect Case statement - select one of many sets of lines to execute
  • 10. VB โ€“ Conditional Statements Syntax If Statement : If i = 10 Then some statements ElseIf i = 11 Then some statements ElseIf i = 12 Then some statements Else some statements End If Syntax Select Statement: Select Case d Case 1 some statements Case 2 some statements Case else some statements End Select
  • 11. VB โ€“ Looping Statements Looping statements are used to run the same block of code a specified number of times. In VBScript we have four looping statements: โ€ขFor...Next statement - runs code a specified number of times โ€ขFor Each...Next statement - runs code for each item in a collection or each element of an array โ€ขDo...Loop statement - loops while or until a condition is true โ€ขWhile...Wend statement - Do not use it - use the Do...Loop statement instead
  • 12. VB โ€“ Looping Statements Syntax for Loop: For i=2 To 10 some code Next Exit a For...Next You can exit a For...Next statement with the Exit For keyword. For i=1 To 10 If i=5 Then some code Exit For End If Next
  • 13. VB โ€“ String Functions Function Description InStr Returns the position of the first occurrence of one string within another. The search begins at the first character of the string InStrRev Returns the position of the first occurrence of one string within another. The search begins at the last character of the string LCase Converts a specified string to lowercase Left Returns a specified number of characters from the left side of a string Len Returns the number of characters in a string LTrim Removes spaces on the left side of a string RTrim Removes spaces on the right side of a string Trim Removes spaces on both the left and the right side of a string
  • 14. VB โ€“ String Functions Mid Returns a specified number of characters from a string Replace Replaces a specified part of a string with another string a specified number of times Right Returns a specified number of characters from the right side of a string Space Returns a string that consists of a specified number of spaces StrComp Compares two strings and returns a value that represents the result of the comparison String Returns a string that contains a repeating character of a specified length StrReverse Reverses a string UCase Converts a specified string to uppercase
  • 15. VB โ€“ Array Functions Function Description Array Returns a variant containing an array Filter Returns a zero-based array that contains a subset of a string array based on a filter criteria IsArray Returns a Boolean value that indicates whether a specified variable is an array Join Returns a string that consists of a number of substrings in an array LBound Returns the smallest subscript for the indicated dimension of an array Split Returns a zero-based, one-dimensional array that contains a specified number of substrings UBound Returns the largest subscript for the indicated dimension of an array
  • 16. VB โ€“ Date Functions Function Description CDate Converts a valid date and time expression to the variant of subtype Date Date Returns the current system date DateAdd Returns a date to which a specified time interval has been added Day Returns a number that represents the day of the month (between 1 and 31, inclusive) FormatDateTime Returns an expression formatted as a date or time Hour Returns a number that represents the hour of the day (between 0 and 23, inclusive) IsDate Returns a Boolean value that indicates if the evaluated expression can be converted to a date
  • 17. VB โ€“ Date Functions Minute Returns a number that represents the minute of the hour (between 0 and 59, inclusive) Month Returns a number that represents the month of the year (between 1 and 12, inclusive) MonthName Returns the name of a specified month Now Returns the current system date and time Second Returns a number that represents the second of the minute (between 0 and 59, inclusive) Time Returns the current system time TimeValue Returns a time Weekday Returns a number that represents the day of the week (between 1 and 7, inclusive) Year Returns a number that represents the year