VBScript Fundamentals and Features

Overview on VBScript

Microsoft Visual Basic Scripting Edition (VBScript) brings active scripting to a wide variety of environments, including Web client scripting in Microsoft Internet Explorer and Web server scripting in Microsoft Internet Information Service (IIS).

VBScript is also used for Network Administration, System Administration and for UFT Test Automation.

If we already know Visual Basic (VB) or Visual Basic for Applications (VBA), VBScript will be very familiar.
The basic concepts of VBScript are common to most programming languages.

VBScript talks to host applications using Windows Script. With Windows Script, browsers and other host applications do not require special integration code for each scripting component.

VBScript Fundamentals and Features

1) Comments (Optional)

    To make the code Readable
    To make disable from execution

2) Data Types

    Check Data Sub Types
    Covert Data from one type to another

3) Declarations

    Constants (Built-in, User defined)
    Variables (Scalar, Array)

4) VBScript Operators


5) Flow Control statements

    a) Conditional Statements
        If Statement
        Select Case Statement

    b) Loop Statements
        Do While / Until ...Loop
        For Each...Next

6) Functions

    a) Built-in Functions
    i) Array Functions
    ii) String Functions
    iii) Date & Time Functions
    iv) Conversion Functions
    v) I/O Functions
    vi) Math Functions etc...

    b) User defined Functions

        Sub procedures (Public (Internal, External), Private)
        Function procedures (Public (Internal, External), Private)

7) Coding conventions

8) Regular Expressions

9) File System Operations

    What is Computer File System?
    Examples for File System Operations
    How end user performs File System Operations
    How to do automatic File System Operations

Create File System Object

Set Variable = CreateObject("Scripting.FileSystemObject")

10) Excel Application Object

It is used to perform operations on Excel Application

Excel Application

Excel File / Excel Work Book

Excel Sheet / Excel Work sheet

Create Excel Application Object

Set Variable = CreateObject("Excel.Application")

11) Word Application Object

It is used to perform operations on Word Application /documents

Create Word Application Object

Set Variable = CreateObject("Word.Application")

12) Database Object Models

    a) Database Connection Object
    It used to connect to Databases
Set Variable = CreateObject("Adodb.Connection")

    b) Dtatbase Recordset Object
    It is used to perform operations on Database Tables

Set Variable = CreateObject("Adodb.Recordset")

13) Dictionary Object

It is used to define Key, value pairs

Set Varible = CreateObject("Scripting.Dictionary")

14) Error Handling

Handling expected and unexpected Errors

    Using Exist property and Conditional statements
    Using Exit Statement
    Using Option Explicit statement
    Using some built functions
    Using On Error Resume Next

15) VBScript Statements


Post a Comment