Vbscript A Stepping-stone To Learn Qtp Automation Tool

Computer Science Education General Science

VBScript: Vbscript is a scripting language developed by Microsoft. It is the simplified version of Visual Basic. It is very closely related to BASIC programming language. What is a Variable? A variable is a container in the computer’s memory which is used to store information that you want to store. It is possible to change the value of the variables inside your script. In VBScript, all variables are of one fundamental datatype: Variant which means it can store different types of data. Naming conventions for Variables While creating variables, you need to follow some rules. These are: They should always begin with a letter and they should not contain a period(.) sign. Variable names should not exceed 255 characters. They should be unique in the scope in which they are declared. They should not have names same as keywords like “Dim”, “For” etc. How can I create variables with the above knowledge? Variables can be created using Public, Private or Dim statements. The most common statement is Dim. For an example, you can use the following syntax to declare variables. ########### Dim var ########### Initially this variable has no value which means its empty. After initializing a variable and assigning a value like in above case, the following expressions will evaluate to True: If var = 0 Then If var = “” Then You can also create variables even without using Dim statement however it is not recommended to do so. Following example will clarify the concept: Dim A A=B+C Is there any way to use keywords as variable names? Yes, there is a way. Through this way we can even use keywords or some special symbols as variable names. Lets see, how it done. For this, you have to place variable names inside brackets. Dim [For] [For] = 20 Msgbox [For] Here, we created a variable named [For] inside brackets which is not possible otherwise. Now the “Msgbox” is a predefined function inside VBScript which is used to display a dialog box to see the value of the variable. The output of the code is: 20 What is Option Explicit statement? Option Explicit is used to force explicit declaration of all variables inside your script. This statement is always used at the top of all VBScript statements. This means, you are forced to declare all your variables using either of the statements “Dim”,“Public” or “Private”. Now lets see what…

Please ENROL FOR FREE or LOGIN to The Website to View The Entire Essay or Term Paper.