Previous Topic

Next Topic

Book Contents

Book Index

Home Page

Run an Application from a Macro

The simple example below illustrates how to use Windows Script Host objects to start Notepad during an inbound call.

Dim WshShell
' Create a WSH Shell object.
Set WshShell = _
CreateObject("WScript.Shell")
' Start a Notepad application.
WshShell.Run ("C:\Windows\notepad.exe")

The example above makes use of the WScript.Shell object, which is used to start and manipulate programs. In the example above, the macro would not wait for the application to finish before continuing. A slight variation of the Run command in the last line of the macro could force the macro to wait:

WshShell.Run _
"C:\Windows\notepad.exe", _
1, _
True

More documentation on this object is available at Microsoft's Windows Scripting Host website: http://msdn.microsoft.com/scripting/windowshost/default.htm.

A more complex example that shows how to use Windows Script Host to control an FTP application can be found in the Voice to FTP example in the Examples folder.

See Also

Automating Windows Tasks

Close the Call Monitor from a Macro

Play a Sound File From a Macro