QTP Descriptive Programs Headline Animator

QTP Descriptive Programs

Monday, May 26, 2008

What are the possible ways to Launch Application from QTP?

a. SystemUtil.Run: This Syntax is used to Open a File or An Application with or without path of the file.
Syntax: SystemUtil.Run “Name of the File”, “Parameters if required [Optional], “Directory of File [Optional], “Mode [Optional]
Name of the File: Required a String Value of a file (Executable/Non-Executable)
Note: No Need to give Path of a File, if the files are system files (i.e. which come from Program Manager). The SystemUtil Object will have default location of all Program Manager Files.
Examples:
1. SystemUtil.Run "Notepad/iexplore/Winword/Excel/Powerpnt/firefox/system32/freecell/msconfig" 'without Path of the file
2. SystemUtil.Run "iexplore", "","c:\Program Files\Internet Explorer" 'with Path of the file
3. SystemUtil.Run "C:\Documents and Settings\User\Desktop\Oops" 'Opens a Folder from a location
b. InvokeApplication: This Syntax is used to open only executable Applications (.exe), Apart from executable applications it doesn’t opens nothing
Example: InvokeApplication "C\Program Files\Internet Explorer\iexplore.exe"
c. Creating an Object: This is a method which is used to launch any kind of application, if it is executable.
Code:
Dim oShell
Set oShell = CreateObject (”WSCript.shell”) 'WSCript is Window Scripting
oShell.run “cmd/notepad/winword” 'Mostly WScript opens only exe files its equal to InvokeApplication
Set oShell = Nothing

No comments: