Home

Introduction to VBScript

 

The VBScript Computer Language

 

Introduction

The Internet has changed and improved in the past few years. From the simple static pages that webmasters used to create with the only goal of making some documents available to potential visitors of their sites, to the full blown and unique platform that the web has become. The tags of the HTML language, however diversified, were not enough to display sophisticated types of documents. Based on this, new languages were developed to respond to new needs. For its part, Microsoft decided to transform one of its existing languages for use on the Internet. The original language was Basic, which derived in Visual Basic. Microsoft therefore created a scripting language adapted for the web but which has its roots in Visual Basic. The language was named Visual Basic Scripting Edition, or VBScript. That's the language we are going to learn on this site.

VBScript is very popular in the world of Microsoft platforms because it appears easy to those who have programmed in Microsoft Visual Basic.

 

VBScript Requirements and Lessons Prerequisites

VBScript is embedded in the Microsoft Internet Explorer browser. Therefore, to use this tutorial (to learn from the lessons on this site), you will need:

  • A computer that runs a Microsoft Windows operating system. I should mention that you will need Internet Explorer but since Windows 95, I have never seen a version of Microsoft Windows that doesn't ship with Internet Explorer. This means that, at the time of this writing, it is included in Microsoft Windows 95, 98, Me, NT, 2000, XP, Windows Server 2003. For this site, I will be using Internet Explorer 6. If you have an older version of Internet Explorer, you can freely download an updated version from the Microsoft web site. Therefore, I assume that, as long as you are using a Microsoft Windows operating system, you already have the browser you need.
  • A text editor. Notepad is a wonderful text editor and it ships with every version of Microsoft Windows operating system. For this tutorial, I will exclusively use Notepad and all my instructions will be for Notepad. If you have another text editor or if you developed your own, feel free to use it.
  • This tutorial assumes that you already know HTML, which you can also learn here.

If you are learning VBScript with the goal of creating Active Server Pages (ASP), you can use any of the major browsers. This means that you can create files that have VBScript scripts with a file extension of .asp. You can view such files in Netscape or Opera.

Learning VBScript

 

Introduction

This site assumes that you know the basics of creating folders or directories, creating and saving a file to the appropriate folder or directory. You should also know all the basic operations of opening, using and closing an application. Sometimes in the tutorials, you will be asked to perform some of these actions.

There are various ways you can create a folder in Microsoft Windows using My Computer, Windows Explorer, or an application such as Notepad. In the My Computer or Windows Explorer, you can first select the drive or an existing folder in which you want to create a new folder or file. Then, on the right side (My Computer) or in the right frame (Windows Explorer), right-click and position your mouse on New:

  • To create a folder, click Folder, type a name for the folder, and press Enter.
  • To create a file, click the type of file from the list, type a name an press Enter.

For the following exercise, we will create a file and a folder using Notepad.

 

Practical Learning: Using Folders and Files

  1. To start Notepad, from the task bar, click Start -> (All) Programs -> Accessories -> Notepad.
  2. In the empty file of Notepad, type VBScript Lessons
  3. To create a folder, on the main menu, click File -> Save.
  4. In the Save As dialog box, click the arrow of the Save In combo box and select the C: drive
  5. Click the Create New Folder button Create New Folder
  6. Type VBScript Lessons and press Enter
  7. In the list of folders, make sure you can see vbslessons
     
    Save As
  8. Click Cancel
  9. To save the file, on the main menu of Notepad, click File -> Save
  10. In the Save As dialog box, click the arrow of the Save In combo box and select the C: drive.
  11. Find and double-click VBScript Lessons to display it in the Save In combo box.
  12. Click the arrow of the Save As Type combo box and select All Files
  13. Click the File Name box and type exercise1.htm
     
    Save As
  14. Click Save
 

Previewing a File

To preview one of the files on this tutorial, you will need a browser such as Netscape, Internet Explorer, or Mozilla Firefox. To preview an HTML file, you can display its folder in the Home Directory, My Computer, or Windows Explorer. After displaying the folder, you can double-click the file. If the browser is already opened, on the main menu, you can click File -> Open. Locate the folder or directory where the file was saved and select the HTML file you want to preview.

Practical Learning: Previewing an HTML file

  1. Open Windows Explorer
  2. Locate the JavaScript Lessons folder where you saved the exercise1.htm file to display it
  3. Double-click the file
     
  4. A browser should open with the file. After viewing the file, close the browser.
 

Copyright © 2004-2010 FunctionX, Inc. Next