adsense


Thursday, 5 November 2015

VB SCRIPT BASICS PAGE 1

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button




VB SCRIPT BASICS






VBScript Basics 


VBScript stands for Visual Basic Scripting that forms a 
subset of Visual Basic for Applications (VBA). VBA is a 
product of Microsoft which is included NOT only in other 
Microsoft products such as MS Project and MS Office but 
also in Third Party tools such as AUTO CAD. 
Features of VBScript 

• VBScript is a lightweight scripting language, which has 
a lightning fast interpreter. 

 

• VBScript, for the most part, is case insensitive. It has 
a very simple syntax, easy to learn and to implement. 

 

• Unlike C++ or Java, VBScript is an object-based scripting 
language and NOT an Object-Oriented Programming language. 

 

• It uses Component Object Model (COM) in order to access 
the elements of the environment in which it is executing. 

 

• Successful execution of VBScript can happen only if it is
 executed in Host Environment such as Internet Explorer (IE), 
Internet Information Services (IIS) and Windows Scripting Host (WSH) 

VBScript – Version History and Uses 
VBScript was introduced by Microsoft way back in 1996 and its
 first version was 1.0. The current stable version of VBScript 
is 5.8, which is available as part of IE8 or Windows 7. 
The VBScript usage areas are aplenty and not restricted to the below list. 

• VBScript is used as a scripting language in one of the 
popular Automation testing tools – Quick Test Professional abbreviated as QTP. 

 

• Windows Scripting Host, which is used mostly by Windows 
System administrators for automating the Windows Desktop. 

 

• Active Server Pages (ASP), a server side scripting 
environment for creating dynamic webpages which uses VBScript or Java Script. 

 

• VBScript is used for Client side scripting in Microsoft Internet Explorer. 

 

• Microsoft Outlook Forms usually runs on VBScript; however, 
the application level programming relies on VBA (Outlook 2000 onwards). 

Disadvantages 


1. OVERVIEW 


• VBScript is used only by IE Browsers. Other browsers such as 
Chrome, Firefox DONOT Support VBScript. Hence, JavaScript is preferred over VBScript. 


 

• Since there is no development environment available by default, debugging is difficult. 
• VBScript has a Limited command line support


Where VBScript is Today? 
The current version of VBScript is 5.8, and with the recent 
development of .NET framework, Microsoft has decided to 
provide future support of VBScript within ASP.NET for web 
development. Hence, there will NOT be any more new versions 
of VBScript engine but the entire defect fixes and security 
issues are being addressed by the Microsoft sustaining 
Engineering Team. However, VBScript engine would be shipped 
as part of all Microsoft Windows and IIS by default. 
 
 
 
 
 
 
 
 
  



2. SYNTAX 


Your First VBScript 
Let us write a VBScript to print out "Hello World". 
 
 
 
 
 
In the above example, we called a function document.write, 
which writes a string into the HTML document. This function
 can be used to write text, HTML, or both. So, the above 
code will display the following result: 
Hello World! 
Whitespace and Line Breaks 
VBScript ignores spaces, tabs, and newlines that appear 
within VBScript programs.  One can use spaces, tabs, and 
newlines freely within the program, so you are free to 
ormat and indent your programs in a neat and consistent way 
that makes the code easy to read and understand. 
Formatting 
VBScript is based on Microsoft's Visual Basic. Unlike JavaScript,
 no statement terminators such as semicolon is used to terminate
 a particular statement. 
Single Line Syntax 
Colons are used when two or more lines of VBScript ought to
 be written in a single line. Hence, in VBScript, Colons act 
as a line separator. 
 
 
Multiple Line Syntax 
When a statement in VBScript is lengthy and if user wishes to
 break it into multiple lines, then the user has to use 
underscore "_". This improves the readability of the code. 
The following example illustrates how to work with multiple lines. 
 
Reserved Words 
The following list shows the reserved words in VBScript. 
These reserved words SHOULD NOT be used as a constant or 
variable or any other identifier names. 

And 	As 	Boolean 
ByRef 	Byte 	ByVal 
Call 	Case 	Class 
Const 	Currency 	Debug 
Dim 	Do 	Double 
Each 	Else 	ElseIf 
Empty 	End 	EndIf 
Enum 	Eqv 	Event 
Exit 	False 	For 
Function 	Get 	GoTo 
If 	Imp 	Implements 
In 	Integer 	Is 
Let 	Like 	Long 
TypeOf 	Until 	Variant 
Wend 	While 	With 
Xor 	Eval 	Execute 
Msgbox 	Erase 	ExecuteGlobal 
Option Explicit 	Randomize 	SendKeys 
Case Sensitivity 
VBScript is a case-insensitive language. This means that 
language keywords, variables, function names and any other 
identifiers need NOT be typed with a consistent 
capitalization of letters. So identifiers int_counter, 
INT_Counter and INT_COUNTER have the same meaning within VBScript. 



Comments in VBScript 
Comments are used to document the program logic and the user 
information with which other programmers can seamlessly work 
on the same code in future. It can include information such 
as developed by, modified by and it can also include incorporated 
logic. Comments are ignored by the interpreter while execution. 
Comments in VBScript are denoted by two methods. 
Any statement that starts with a Single Quote (‘) is treated as 
comment. Following is the example: 
<script language="vbscript" type="text/vbscript"$gt; 
 
 
Any statement that starts with the keyword “REM”. Following is the example: 
<script language="vbscript" type="text/vbscript"> 
<!— 
  REM This Script is written to Validate the Entered Input 
  REM Modified by  : Tutorials point/user2 
//- > 
</script>



Not all the modern browsers support VBScript. VBScript 
is supported just by Microsoft's Internet Explorer 
while other browsers (Firefox and Chrome) support 
just JavaScript. Hence, developers normally prefer 
JavaScript over VBScript.  
Though Internet Explorer (IE) supports VBScript, 
you may need to enable or disable this feature 
manually. This tutorial will make you aware of the 
procedure of enabling and disabling VBScript support in Internet Explorer. 

VBScript in Internet Explorer 
Here are simple steps to turn on or turn off VBScript in your Internet Explorer: 

• Follow Tools -> Internet Options from the menu 

 

• Select Security tab from the dialog box 

 

• Click the Custom Level button 

 

• Scroll down till you find Scripting option 

 

• Select Enable radio button under Active scripting 

 

• Finally click OK and come out 

To disable VBScript support in your Internet Explorer, you need 
to select Disable radio button under Active scripting. 







No comments: