VBScript
Sub categories:

Loading ...
Window Environment variables can be used to store User specific or Machine specific information. This information is accessible to all windows program. Below is the list of some common windows environment variables
TEMP - Temporary directory path
TMP - Temporary directory path
PATH - Folder locations where a file is searched when the complete path is not provided
windir [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 704 times
Tags used -
access, Accessing, Environment, read, System, update, USER, variable, windows, write

Loading ...
A List of values may contains few duplicates and if we need to find the unique values out of the same then we need some algorithm to filter that out. Consider we have an array of values as give below
Dim arrLOV
arrLOV = Array ("Val1", "Vale2", "Val2", "Val1", "Val3", "Val2")
Now the array contains 2 duplicate values [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 308 times
Tags used -
duplicate, duplicates, filter, List, remove, unique, values

Loading ...
Arrays containing a list of values can be evaluated for their sort order, whether they contain values in ascending order, descending order or not sorted. To check the same we can use the function given below
‘Function: GetArraySortOrder
‘Author: Tarun Lalwani
‘Website: http://KnowledgeInbox.com
‘Description: Finds the sorting order of a given array
‘Parameters:
‘@arrLOV: The array of values
‘Return value:
‘ 1 - [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 339 times
Tags used -
array, ascending, descending, order, sort, sorting

Loading ...
Comparison between 2 different list of values to find the missing and additional parts can be complex task if the algorithm. Let us consider 2 different arrays
Array1 = {"a", "b", "c", "b", "f"}
Array2 = {a", "e", "d", "g"}
Now from visual inspection we can notice that
Array1 is missing “e”, “d” and “g”
Array1 has additional element “c” [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 570 times
Tags used -
array, arrays, between, compare, Comparison, difference, Find, lists, missing, two, values

Loading ...
At times, we might want to maintain a list of all objects which are created for an object. We will not discuss the situations where it would be required, but we will see how it’s done.
To store the list of object we can use the Dictionary objects. When we create classes object the first event [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 787 times
Tags used -
Class, Classes, Class_Initialize, Class_Terminate, Collection, Dictionary, List, Maintain, Maintaining, Nothing, store, Storing

Loading ...
Recently while automating an application it was required for me to fill a relative date in one of the place. This meant capturing a reference date from the screen and adding a relative date to the same. The relativity of the date can be expressed in various forms as shown below
1 hr
2 days 3 hours
1 [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 574 times
Tags used -
Add, date, Reference, Relative, time

Loading ...
VBScript is a scripting language. A VBScript can be executed in various ways
Using Windows Script Host (wscript.exe and cscript.exe). Will cover this later
Inside HTML page for IE Browser.
Other host process which allows to execute code in VBScript format (ex - HP QuickTest Pro)
Internal methods and objects
VBScript provides method and objects that can be used [...]
Read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 8,337 times
Tags used -
command, CScript, HTML, IE, Introduction, Mercury, VBScript, WScript

Loading ...
What is variable?
Variable is a named container used to store values
Declaring a variable
There are three possible ways to declare a variable
Dim <variablename>
Public </variablename><variablename>
Private </variablename><variablename></variablename>
Ex –
Dim x, y, z
Dim a
Dim b, c
Variable naming rules
Variable names should following the below rules
Must not exceed 255 characters.
Must be unique in the [...]
Read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 5,387 times
Tags used -
Coding, Const, convention, date, Double, explicit, float, function, int, naming, option, standards, time, VB, VBScript

Loading ...
While running a VBScript file from the WScript host, one might want to access the file located in the same folder as the script. WScript does not run your script keeping the current directory as the folder in which the script located. Using just the file name like “Logs.txt”, “Input.xls” will try to access the [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 935 times
Tags used -
Current, directory, file not found, Folder, InStrRev, location, ScriptFullName

Loading ...
Formatting a date/time to the required format is a complex job when working with various times zones or different date formats (Ex - dd/mm/yyyy or mm/dd/yyyy). VB provides a very convenient method named Format to do these formatting. But unfortunately it’s pretty much a missing functionality in VBScript. The code i present in this article [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 1,349 times
Tags used -
Change, date, format, Now, time, Zone

Loading ...
This article will demonstrate how to reverse word in a string. VBScript has many string methods like Left, Mid, Right, Split, Join and Len for string manipulation.
Creating a code generic enough to handle such string correctly is a complex task. But the task is much simpler when we use regular expressions (r.e.). The key here [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 712 times
Tags used -
Global, Len, Matches, Mid, pattern, RegExp, regular expression, reverse, Split, String, word, words

Loading ...
Dictionary object allows storing key value pairs. A dictionary object can be used for easy lookup of values. Dictionary is a not a QTP specific functionality and is available in normal VBScript as well.
Creating the Dictionary
A dictionary object can be created using CreateObject for COM class “Scripting.Dictionary”. The code below shows how to create the [...]
Register or Login to read the full article...Have questions related to this article? Want to request a new article? Use our forums to post your questions
Viewed 20,580 times
Tags used -
Check, CreateObject, Dictionary, Exists, Extend, Key, Scripting, Value