@script::exec

The exec method executes the program specified by absolute path passed as a parameter. The timeout parameter represents the period to wait, in milliseconds, for the executable to complete before it is terminated.

Replaces the @script:execute() method; returns more information than a simple true or false upon completion of the executable.

Syntax:

@script::exec(ScriptVariable executable, int timeout)

Parameters:

Returns:

A ScriptObject with the following variables:

Example:

In the following example, xMatters would run Notepad and open the ToDoList.txt file if it was on the path:

$runList = "notepad.exe"

$runList::add("TodoList.txt")

@result = @script::exec($runList, 1000)

IF ($result.exception != "")

   @script::log("Error - Exception raised running TodoList.txt " & $result.exception)

ELSE-IF ($result.exitValue == 0)

   @script::log("TodoList.txt: " & $result.standardOut)

ELSE

   @script::log("Error displaying TodoList.txt: " & $result.standardOut)

ENDIF