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 ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.