VBScript (diminutive of Microsoft Visual BASIC Scripting Edition ) is a subset of Visual BASIC used as a Langage of script of general use. VBScript is often compared with the Javascript, whereas the JavaScript is primarily used for Web scripts, a VBScript script has a field of application much broader.

Environments of use

VBScript can function under many environments, in particular:
  • Windows Scripting Host (WSH): it is about an interpreter of scripts for the Microsoft Windows systems, making it possible to write scripts so, for example, to facilitate their administration.
  • Microsoft Internet Explorer : the VBScript language can be integrated in pages HTML, as well as the Javascript in order to offer interactive functionalities.
  • Microsoft Internet Information Server (IIS): it is about the Web server of Microsoft. VBScript is the language privileged for the programming of pages Active Server Pages (ASP), i.e. the writing of dynamic Web pages managed on the side waiter.

VBScript is often used to replace the files batch DOS.

It does not function on the Explorer versions for OS mac

Interpreted language

Like any language of script, VBscript is an interpreted language. It does not require compilation before being carried out. On the other hand, it requires that the machine intended to carry out them has an interpreter, a program able to include/understand the whole of the instructions present in the program. According to the use different the " interpréteurs" are:
  • ASP (asp.dll) in an environment Web
  • wscript.exe in an environment Windows
  • cscript.exe in an environment with line of order

The VBScript files for Windows Scripting Host generally have the Extension of file .vbs.

Other extensions exist and allow the execution of VBscript such as:

  • VBE : Coded VBScript (not éditable).

  • WSF : Being able to contain different languages at the same time (ex: VBS and JS), of beacons XML indicate the language of each source.
  • WSC : Source file Windows Components Script.
Program example (to be put in a file “bonjour.vbs”):

MsgBox " Hello the world! "

If Windows Scripting Host correctly is installed and activated, the program will be carried out with the double-click on its icon.

The version of VBScript implemented in Internet Explorer contains functions very similar to those of the JavaScript; it has an interpreter who treats the code integrated into HTML, and cannot create independent applications. It does not have practically any compatibility with the other navigators, then much of Webmasters rather prefer to use JavaScript.Il does not function for example with any the navigators proposed on Apple.

VBScript is also implemented in Microsoft Outlook like a Langage of script used to answer the events of the Outlook forms.

Some common examples of applications of VBScript are technology Microsoft Agent and the service Windows Update. As these two examples also use technology ActiveX, it is obligatory to use Internet Explorer to see the Web pages using VBScript.

Language of script Internet

VBscript is a language specific to Microsoft and is interpreted only by Internet Explorer. Of this fact this language does not have the portability of Javascript for example. VBScript was implemented for the first time in Internet Explorer in version 3 of the navigator, but the absence of interworking with Netscape/Mozilla/Opera implies that, when that is possible, JavaScript is preferred to him.

See also: HTML Application

Key words

  • Dim declares a variable
  • yew if (condition)
  • then
  • else
  • end yew
  • C while
  • while… wend
  • for… next
  • C… loop
  • MOD
  • & combines chains
  • Inputbox box of seizure
  • msgbox dialog box
  • copyfile copy a file
  • deletefile removes a file
  • fileexists research if a file exists

Syntax

The creation of a script VBS is very easy:
  1. Lancer a text editor (standard Notepad)
  2. Copy the instructions of script (below)
  3. Sauvegarder the file with an extension “.vbs”
  4. Ouvrez to card-index it for excécuter script

For example a small script to give the hour: Hour =" It is " & Hour (Now) & " H and " & Minute (Now) & " min." yew Hour (Now) <=18 then Message=" Bonjour" else Message= " Bonsoir" end yew MsgBox Message & "! " & vbnewline & Hour

Object language

VBS makes it possible to handle the object S Windows. It also makes it possible to create classes in which the members can be either private, or public. The heritage does not exist however in VBS.

Computer viruses and VBScript

Making it possible to practically carry out any operation under a system Windows by using technology ActiveX, VBscript was used for the creation of many viruses informatiques.
Many viruses written in VBscript appear in the year 2000. One of most known is the virus " VBS.LoveLetter" also known under the name of " Virus I coils you ".

Editors

Simple text editors as Notepad are enough to develop in VBS.

Nevertheless, there exist many editors dedicated to the VBS like:

  • VBS Factory
  • Microsoft Script Editor (Languages of scripts of which VBS)

Internal bonds

JScript another language usable with WSH, the interpreter of VBScript.

External bonds

  • Visual BASIC - Development center Site MSDN from Microsoft France, Contents complete for beginner, confirmed and expert

  • VBScript User' S Guides (English)

  • the FAQ VBScript on www.developpez.com (French)

Random links:Not-Saint-the Homer | Richard Gregoire | Man-monkey of New Delhi | President of the Republic by interim | Suzana Petersen

© 2007-2008 speedlook.com; article text available under the terms of GFDL, from fr.wikipedia.org