Tag Archive: DotNetFactory

Apr 01 2008

Formatting Messages and Strings

The System.Text.StringBuilder class represents a mutable string of characters. This class represents a string-like object whose value is a mutable sequence of characters. The value is said to be mutable because it can be modified once it has been created by appending, removing, replacing, or inserting characters. the AppendFormat method Appends a formatted string, which …

Continue reading »

Apr 01 2008

Ping a Specified Server

The Network Class belongs to Microsoft.VisualBasic.Devices namespace. The .NET Ping method is overloaded, the return value is always Boolean. ( Conversion Required ) String. The URL, computer name, or IP number of the server to ping. Required. Uri. The URI of the server to ping. Required. Int32. Time threshold in milliseconds for contacting the destination. …

Continue reading »

Apr 01 2008

Send Keys to Active Window

The Keyboard.SendKeys Method sends one or more keystrokes to the active window, as if typed on the keyboard. Syntax: object.SendKeys( keys, wait ) Parameters : keys – A String that defines the keys to send. wait – Optional. A Boolean that specifies whether or not to wait for keystrokes to get processed before the application …

Continue reading »

Apr 01 2008

Keyboard Status

The Devices.Keyboard class Provides properties for accessing the current state of the keyboard, such as what keys are currently pressed, and provides a method to send keystrokes to the active window. How can we know if CAPS-LOCK already pressed? Before we use the numpad keys we want to verify that if NUM-LOCK already pressed. The …

Continue reading »

Apr 01 2008

Where is my Mouse?

The System.Windows.Forms.Control Class Defines the base class for controls, which are components with visual representation. The Control.MousePosition Property gets the position of the mouse cursor in screen coordinates. The property returns a Point that contains the coordinates of the mouse cursor relative to the upper-left corner of the screen. The MousePosition property returns a Point …

Continue reading »

Mar 31 2008

Determine the Day of the Week

Dot.Net Framework provides several classes for dates and times. the primary class is the System.DateTime. The class Represents an instant in time, typically expressed as a date and time of day. The System.DayOfWeek enumeration Specifies the day of the week. Friday Indicates Friday. Monday Indicates Monday. Saturday Indicates Saturday. Sunday Indicates Sunday. Thursday Indicates Thursday. …

Continue reading »

Mar 31 2008

Determine if a Folder Exists

System.IO.DirectoryInfoclass exposes instance methods for creating, moving, and enumerating through directories and subdirectories. The example verifies if a directory exists. The dirInfo is built using the directory name constructor. Is a very good practice to verify if a directory exists, before accessing the directory. Dim dirInfo, dirName dirName = “C:\LOG” Set dirInfo = DotNetFactory.CreateInstance( “System.IO.DirectoryInfo”,, …

Continue reading »

Mar 31 2008

Copy/Move all Contents of a Directory

System.IO.DirectoryInfo class exposes instance methods for creating, moving, and enumerating through directories and subdirectories. System.IO.File Provides static methods for the creation, copying, deletion, moving, and opening of files. Public Sub CopyDirectory( ByVal sourceDirectory, ByVal targetDirectory ) Dim srcInfo, trgInfo, sysFile, sourceFiles, sourceDirectories Dim i, j, fileItem, folderItem Set srcInfo = DotNetFactory.CreateInstance( “System.IO.DirectoryInfo”,, sourceDirectory ) Set …

Continue reading »

Mar 31 2008

Create a Directory Listing

The following code example shows how to use the I/O classes to create a listing of all files with the extension “.exe” in a directory. The output data is inserted to the local data sheet and also print to the QTP log. Option Explicit Dim pathStr Dim fileInfo, dirInfo, ioDir, dirsInfo Dim nFile, nLength DataTable.LocalSheet.Addparameter …

Continue reading »

Mar 31 2008

Rename or Move a Directory

The following code example shows how to use the I/O classes to create a listing of all files with the extension “.exe” in a directory. The output data is inserted to the local data sheet and also printed to the QTP log. Option Explicit Dim pathStr Dim fileInfo, dirInfo, ioDir, dirsInfo Dim nFile, nLength DataTable.LocalSheet.Addparameter …

Continue reading »

Older posts «

Fetch more items