VBScript Conditional Statements

VBScript Conditional Statements

VBScript Conditional Statements, VBScript Language Fundamentals, VBScript Control Flow, VBScript If Statement, and ‘Select Case’ statement. VBScript Conditional Statements 1. Execute a Statement when the condition is True. Syntax: If Condition Then Statement Example: Dim myDate myDate = #10/10/2010# If myDate < Date Then myDate = Date Msgbox myDate myDate = #10/10/2017# If myDate < … Read more

VBScript Tutorial

VBScript Tutorial

VBScript Tutorial, Environment, VBScript Syllabus, Variables, Control Flow, Functions, Automation Objects, and Write & Run VBScript Programs. VBScript began as part of the Microsoft Windows Script Technologies, launched in 1996. VBScript (“Microsoft Visual Basic Scripting Edition”) is an Active Scripting language developed by Microsoft that is modeled on Visual Basic VBScript stands for Visual Basic … Read more

 User Defined Functions in VBScript

 User Defined Functions in VBScript  VBScript Functions > In Structured Programming (Ex: C Language) we use Functions (Built-in and user defined). > In Object Oriented Programming (ex: Java) we use Methods (Built-in and user defined). > In VBScript we use Functions and Methods (Object based language). What is Function? A reusable code. When we choose … Read more

VBScript Built in Functions

VBScript Built in Functions 1) Asc Function It returns ANSI character code for first letter of a string or number. ‘A to z (65 to 90) ‘a to z (97 to 122) ‘0 to 9 (48 to 57) Example: Dim a a =”ABCD” Msgbox Asc(a) ’65 Msgbox Asc(“A”) ’65 Msgbox Asc(“Z”) ’90 Msgbox Asc(“a”) ’97 … Read more

VBScript Tutorial 5

VBScript Tutorial 5 (VBScript Functions) I) VBScript User defined Functions i) Create a Sub Procedure with no Arguments Sub Login () SystemUtil.Run “C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe” Dialog(“Login”).Activate Dialog(“Login”).WinEdit(“Agent Name:”).Set “asdf” Dialog(“Login”).WinEdit(“Password:”).SetSecure “5566695dab8b9f47c06f8ba443bdba84f0d5274e” Dialog(“Login”).WinButton(“OK”).Click End Sub Call Login() ————————————————— ii) Create a Sub Procedure with Arguments Sub Login (Agent, Password) SystemUtil.Run “C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe” Dialog(“Login”).Activate … Read more

UFT Class 28

UFT Class 28 (VBScript Built in Functions part-2, Many to Many Comparisons Example) 28) CreateObject Function It creates an automation object in a specified class. Examples: Dim objFso ‘Create File System Object, It is used to work with Drives, folders and files. Set objFso = CreateObject(“Scripting.FileSystemObject”) Dim obJExcel ‘Create Excel Application object, It is used … Read more

UFT Class 27

UFT Class 27 (VBScript Built in Functions) 1) Abs Function (It returns absolute value) Dim val val = 100.75 Msgbox Abs(val) ‘100.75 val = 100.25 Msgbox Abs(val) ‘100.25 Msgbox Abs(100.60) ‘100.6 val = -100.85 Msgbox Abs(val) ‘100.85 2) Round Function Dim val val = 100.75 Msgbox Round(val) ‘101 val = 100.25 Msgbox Round(val) ‘100 Msgbox … Read more

UFT Class 21

UFT Class 21 (VBScript Fundamentals and Features) 1) Comments To make the code readable To make the code disable from execution 2) Data Types VBScript supports implicit declaration of Data Types. In VBScript, only data type is Variant. Using VarType function we can check data sub-type Ex: Dim a a =”abcd” a = 123 a … Read more