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