Objectives
The objectives of this article are :
Learn how to use DOS command lines in QTP.
Alternative complex tasks.
Alternative .NET methods.
The following content is viewable because you are logged-in.
Thanks for registering!
cmd.exe allows access to the Microsoft Windows Command Prompt, also known as Microsoft DOS.
To-date, cmd.exe is a 32-bit command prompt used in Windows NT, 2000, and XP and offers disk and file maintenance functions to your computer as well as network functions. cmd.exe can be found under System32 folder.
SystemUtil.Run "cmd.exe","","C:\WINDOWS\system32″,"open"
Capture the window by QTP
Window( "object class:=ConsoleWindowClass" )
Print Window( "object class:=ConsoleWindowClass" ).GetROProperty( "title" )
Typing to DOS window
The Type method types the specified string in the window.
Syntax: object.Type KeyboardInput.
KeyboardInput : A String value. The text string and/or constants representing non-alphanumeric keys.
Catching the Response
The GetVisibleText method returns the text from the specified area. The text to capture must be visible in the application window when the step runs. The area is defined by pairs of coordinates that designate two diagonally opposite corners of a rectangle.
Syntax : object.GetVisibleText ([Left], [Top], [Right], [Bottom])
txt = Window( "object class:=ConsoleWindowClass" ).GetVisibleText()
print txt