VBScript has only one data type called a Variant. There are different categories of information that can be contained in a Variant, called subtypes. These subtypes are:
Empty, Null, Boolean, Byte, Integer, Long Single, Double, Date/Time, Currency , String , Object and Error.
Posted Date:- 2021-09-23 06:00:49
VBScript is a subset of Visual Basic for Applications, but there are still many differences:
VBScript doesn't have a debugger like Visual Basic or you can say that VBScript does not provide any debugging features.You'll resort to using lots of message boxes, instead.
Unlike Visual Basic and Visual Basic for Applications, in which the developer can define the data type of a variable in advance, all variables in VBScript are variants.
There is no integrated development environment for VBScript that parallels the IDE for Visual Basic and Visual Basic for Applications.
Because variables are untyped and code is not compiled, all external objects instantiated in VBScript code are necessarily late-bound. This has a number of implications. First, late binding typically entails a substantial performance penalty in comparison to early binding. Second, while the properties and methods of early-bound objects can be examined in Visual Basic or hosted VBA environments using the Object Browser, this is not the case with late-bound objects. Finally, the help facilities available for early-bound objects in VB and VBA (like Auto List Members and Auto Quick Info) are not available, making syntax errors more likely and ready access to good documentation all the more necessary.
Posted Date:- 2021-09-23 06:00:02
For Each Loop is used in the case of Arrays. This is an extension of For Loop only. In case of repeating the code for each index value of an array then you can use ‘For Each Loop’.
Posted Date:- 2021-09-23 05:56:02
If we declare variables with some values and while using if we use (spell mistake) then user can’t know
‘ putting option explicit is useful there
‘ Example starts here
option explicit
dim abcd
abcd=20
msgbox abcd
dim bcde
bcde=30
msgbox bcdef
Posted Date:- 2021-09-23 05:54:39
The actions that are performed by clicking, pressing keys, moving mouse, dragging and dropping etc are called as events. Event handling is the way to capture these events and perform the actions accordingly.
Posted Date:- 2021-09-23 05:53:52
This class provides file system objects which help the developers to work with drives, folders and files.
Example:
Dim oFS, drive
Set oFS = CreateObject("Scripting.FileSystemObject")
Set drive = oFS.GetDrive(oFS.GetDriveName("C:"))
Document.write drive.VolumeName
Posted Date:- 2021-09-23 05:52:32
The StrComp Function returns an integer value after comparing the two given strings. It can return any of the three values -1, 0 or 1 based on the input strings to be compared.
* If String 1 < String 2 then StrComp returns -1
* If String 1 = String 2 then StrComp returns 0
* If String 1 > String 2 then StrComp returns 1
Posted Date:- 2021-09-23 05:51:43
Order of evaluation of operators is, first arithmetic operators are evaluated, and comparison operators are evaluated next and at the last logical operators are evaluated at the last. In arithmetic operators negation, Exponentiation, multiplication and division, integer division, modulus arithmetic, addition and subtraction and string concatenation are provided.
Posted Date:- 2021-09-23 05:50:27
In VBScript, you can write hello world in two ways, the program will display a message box with text hello world.
1. MsgBox “Hello Worldâ€
2. Echo “Hello Worldâ€
Posted Date:- 2021-09-23 05:49:49
Tristate constants can be used with functions which allow formatting of numbers. These constants can be used with VB Script without defining them. It can be used anywhere in the code to reflect and represent the values.
Posted Date:- 2021-09-23 05:49:03
The main difference between function and sub-procedure is that function returns a value whereas a Sub-procedure does not.
Posted Date:- 2021-09-23 05:48:13
No. it is not possible. QTP is the engine that runs through it. The VBScript relies on the QTP UI to perform the actions, such as clicking on a link on a web page.
Posted Date:- 2021-09-23 05:47:39
The loops which are available in the VBScript language are broadly categorized into 3 types and they are – For Loops, Do Loops and While Loops.
Posted Date:- 2021-09-23 05:46:43
Two ways to declare a variable are:
Implicit Declaration: When variables are used directly without declaration, it is termed as Implicit Declaration. However, it’s not a good practice because at any point if the variable name is not spelled correctly in the script then it can produce wrong results while running and at times, it will not even be easy to be detected by the user.
Explicit Declaration: Declaring the variables before using them is known as the Explicit Declaration of variables.
Posted Date:- 2021-09-22 13:08:41
Following are the advantages of VBScript −
i. VBScript is a lightweight scripting language, which has a lightning fast interpreter.
ii. VBScript, for the most part, is case insensitive. It has a very simple syntax, easy to learn and to implement.
iii. Unlike C++ or Java, VBScript is an object-based scripting language and NOT an Object-Oriented Programming language.
iv. It uses Component Object Model (COM) in order to access the elements of the environment in which it is executing.
v. 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).
Posted Date:- 2021-09-22 13:06:23
The Public constants are available for all the scripts and procedures.
Posted Date:- 2021-09-22 13:04:49
No. This actually means that variable names, keywords, constants, and other identifiers are not required to be typed with a consistent capitalization of letters i.e. if you type ‘Optional’ keyword as OPTIONAL, optional or Optional then these all mean the same in the VBScript language.
Posted Date:- 2021-09-22 12:43:19
ADODB.Stream class can be used as string builder. VBScript string concatenation can be very costly because of frequent memory allocation features. Binary file and memory I/O operation is provided by ADODB.Stream class. This is widely used to convert bytes into string, etc.
Posted Date:- 2021-09-22 12:41:05
The use of Option Explicit statement in VBScript is to initialize all the variable before using them. It helps to avoid typing error in the code.
Posted Date:- 2021-09-22 07:22:09
If you do not specify anything when you call a procedure, then the argument/arguments are passed by reference by default.
Posted Date:- 2021-09-22 07:21:20
ByRef and ByVal Parameters in VBScript is used to pass VBScript argument to the procedures by reference or by value
Posted Date:- 2021-09-22 07:20:48
An ideal position to include VBScript in HTML is,
Inside Head Section
Inside Body Section
Inside External File
Posted Date:- 2021-09-22 07:20:10
Data in an array can be accessed by referring to the name of the array and the element’s index number.
Posted Date:- 2021-09-22 07:19:18
The simplest way to create a cookie is to assign a string value to the document.cookie object.
Posted Date:- 2021-09-22 07:18:47
To assign a date value to a variable, Date and Time variables should be enclosed within a hash symbol(#).
Posted Date:- 2021-09-22 07:18:21
The Dim keyword is used to declare a variable in the VBScript language. However, depending upon the scope of the variable, public or private keywords can also be used.
Posted Date:- 2021-09-22 07:18:00
Following are the disadvantages of VBScript:
1. VBscript is used only by IE Browsers. Other browsers such as Chrome, Firefox DONOT Support VBScript. Hence, JavaScript is preferred over VBScript.
2. VBScript has a Limited command line support.
3. Since there is no development environment available by default, debugging is difficult.
Posted Date:- 2021-09-22 07:17:24
Following are the rules for declaring a Variable name:
1. It must always start with a letter. For Example, output, name, etc. Variable Name should not start with a number or any special character like _va123, 12non, etc.
2. It cannot exceed the limit of 255 characters.
3. It should never contain a period (.).
Posted Date:- 2021-09-22 07:16:07
Using FormatPercent function, which would return an expression formatted as a percent.
Example:
Dim num : num = -645.998651
document.write(FormatPercent(num, 2))& "<br/>" '-64,599.86%
Posted Date:- 2021-09-22 07:14:41
No. This actually means that variable names, keywords, constants, and other identifiers are not required to be typed with a consistent capitalization of letters i.e. if you type ‘Optional’ keyword as OPTIONAL, optional or Optional then these all mean the same in the VBScript language.
Posted Date:- 2021-09-22 07:13:15
You use Function procedures when you want to execute a series of statements and return a value.
1. Function procedures start and end with Function and End Function statements
2. A function procedure may or may not take input.
3. Function procedures return a value by assigning the value to its name
Posted Date:- 2021-09-22 07:11:31
Scripting Runtime library is very important for the functioning of Visual basic script because it gives much more functionality such as File management, text operations and file modification features. Scrrun.dll is used very much in programming VB.
Posted Date:- 2021-09-22 07:10:02
Active X technology can be used to give much more functionality to VB Script. VB provides sub routines, functions, string manipulation, data/time, error handling, etc. VB can have more functionality added to it by working with languages such as ASP.
Posted Date:- 2021-09-22 07:09:03
VBScript procedures are primarily used for code organization and reuse. There are mainly two types of VBScript procedures: Sub procedures and Function procedures.
Posted Date:- 2021-09-22 07:08:24
VB and Java Script are much similar in functionality. They both interact with the document object model of the page. Many browsers have compatibility with Java Script but they are not compatible with VB script as such. For client side scripting developers using VB Script should always make sure of cross browser compatibility which is not the case when working with VB script.
Posted Date:- 2021-09-22 07:08:03
If functionality aspect is considered VB Script acts similar to Java Script but it is compatible only on internet explorer. They interact with Document object model. Visual basic script can also be used for server side processing with ASP.
Posted Date:- 2021-09-22 07:07:37
.hta extension is used whenever you want to include a VB script in HTML. Here HTML acts as an interface and VB Script as the programming language. .hta extension files do run in the safe and trusted zone of Internet explorer. Although they run in the trusted zone querying is restricted as it has to pass the guidelines of internet explorer.
Posted Date:- 2021-09-22 07:07:15
There are some words that work as Reserved Words and they cannot be used as Variables names, Constant names or any other Identifier names, these are known as keywords. Some of the keywords in the VBScript language are Not, Nothing, Preserve, Optional, etc.
Posted Date:- 2021-09-22 07:06:50
A variant in VBScript is a data type. A Variant can contain either string or numeric information. A Variant behaves like a string when you use it in a string context and as a number when you use it in a number context.
Posted Date:- 2021-09-22 07:06:29
VBScript allows you to use variables without declaring it known as ‘loose binding.’ It is not an ideal practice to use it. Because if you misspell the same variable when you use it again then VBScript will not show you of the error.
Posted Date:- 2021-09-22 07:06:01
.wsf files are modeled in similar to XML. They can be executed with the help of Wscript.exe and it can be done from the command line also. This .wsf file can have multiple visual basic files. Reuse functionality is present with this extension file.
Posted Date:- 2021-09-22 07:05:36
Colons (:) act as a line separator and Underscore (_) is used to break the lengthy statement into multiple statements in the VBScript language.
Posted Date:- 2021-09-22 07:05:17
Any Statement that starts with a single quote (‘) or with the keyword ‘REM’ is treated as a Comment.
Posted Date:- 2021-09-22 07:04:55
VBScript file is saved with an extension of .vbs.
Posted Date:- 2021-09-22 07:04:35
There is only one data type that is supported by VBScript language and it is called as the ‘Variant’. If we use this data type in the String context then this will behave like a String and if we use this in Numeric context then this will behave like a Number. This is the specialty of the Variant data type.
Posted Date:- 2021-09-22 07:04:23
To name variable in VBScript there are certain rules, you need to use the keyword ‘Dim‘. For example, Dim salary. Also, you need to remember the following things
>> Variable name must begin with a letter
>> Variable name cannot exceed 255 characters
>> Variable name should not contain a period (.)
Posted Date:- 2021-09-22 07:03:53
VBScript can run in the following 3 environments:
* IIS (Internet Information Server) – This is Microsoft’s Web Server.
* WSH (Windows Script Host) – This is the hosting environment of the Windows Operating System.
* IE (Internet Explorer) – This is the most frequently used environment to run scripts and this is the simple hosting environment.
Posted Date:- 2021-09-22 07:02:59
VBScript is a lightweight primary scripting language which is used for automation of the Scripts in QTP (Quick Test Professional) tool. This is modeled upon Visual Basic language.
Posted Date:- 2021-09-22 07:01:57
A simple example detailing the running of VB Script is by utilizing Windows Script host environment. Visual basic is a stand alone application which has a .vbs as extension. Input can be provided through graphical user interface and output can be obtained by Wscript.exe from dialog and input boxes. From command line it can be invoked by Cscript.exe.
Posted Date:- 2021-09-22 07:01:28
VB script is a Microsoft programming language and it resembles a lower version of the VB. It is an Active Scripting language. This scripting language is included in windows operating system by default. With the use of msscript.ocx you can install VB Script.
Posted Date:- 2021-09-22 07:00:36