Book Image

Advanced UFT 12 for Test Engineers Cookbook

Book Image

Advanced UFT 12 for Test Engineers Cookbook

Overview of this book

Table of Contents (18 chapters)
Advanced UFT 12 for Test Engineers Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Running a process using the Windows® system shell


In Chapter 8, Utility and Reserved Objects, we described the SystemUtil object and learned how to open an application using the Run method. In this recipe, we will describe how to accomplish the same by using the Wscript.Shell object.

Getting ready

From the File menu, navigate to New | Test, or use the Ctrl + N shortcut. You can use the same test as in the previous recipe.

How to do it...

The syntax to run an application (or an external script) is as follows:

object.Run sApplicationPath, [intWindowStyle], [bWaitOnReturn]

Here, object is an instance of the Wscript.Shell class, and sApplicationPath is a valid application path. The intWindowStyle (refer to the following table) and bWaitOnReturn variables (True/False) are optional. By default, the script does not wait until the external application finishes and returns 0.

The following table enumerates the possible values of intWindowStyle (this is sourced from the Help file on the Microsoft Windows...