VBScript

Sub categories:

Accessing Window Environment Variable

1 Star2 Stars3 Stars4 Stars5 Stars (3)
Loading ... 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 617 times

Removing duplicate values from a List of Values

1 Star2 Stars3 Stars4 Stars5 Stars (4)
Loading ... 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 246 times

Checking Sort Order of List of Values

1 Star2 Stars3 Stars4 Stars5 Stars (4)
Loading ... 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 287 times

Comparing 2 List of Values and finding differences

1 Star2 Stars3 Stars4 Stars5 Stars (4)
Loading ... 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 461 times

Maintaining list of class objects created

1 Star2 Stars3 Stars4 Stars5 Stars (5)
Loading ... 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 752 times

Add date and time using string addition - “2days 1hr 10 min”

1 Star2 Stars3 Stars4 Stars5 Stars (3)
Loading ... 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 526 times

VBScript Part 1 - Introduction

1 Star2 Stars3 Stars4 Stars5 Stars (8)
Loading ... 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,130 times

VBScript Part 2 - Variables

1 Star2 Stars3 Stars4 Stars5 Stars (8)
Loading ... 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,302 times

Getting files from current script location

1 Star2 Stars3 Stars4 Stars5 Stars (4)
Loading ... 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 878 times

Formatting date and time

1 Star2 Stars3 Stars4 Stars5 Stars (2)
Loading ... 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,261 times

Reversing words “This is a test” to “test a is This”

1 Star2 Stars3 Stars4 Stars5 Stars (1)
Loading ... 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 656 times

Extending Dictionary Object

1 Star2 Stars3 Stars4 Stars5 Stars (8)
Loading ... 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,341 times
  1. Suscribe to Email

    Enter your email address:

    Delivered by FeedBurner

  2. Most Viewed


  3. Sitemap

    open all | close all
  4. Most Rated

  5. Translator

    English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flag
    Croat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flag
    Slovak flagSlovenian flagUkrainian flagVietnamese flag           
    By N2H

Your Ad Here