Description
The Active
property specifies whether the given task is enabled or disabled (the Active property of the task). A task must be enabled in order to run it via the job to which it belongs or via the entire network suite to which the job belongs.
Declaration
TaskObj.Active
Read-Write Property | Boolean |
TaskObj | An expression, variable or parameter that specifies a reference to a Task object |
Applies To
The property is applied to the following object:
Property Value
True if the task is enabled, and False otherwise.
Example
For instance, you can check whether the desired task is enabled before running it:
JavaScript, JScript
function Test()
{
var Task = NetworkSuite.Jobs(0).Tasks.ItemByName("Task1");
if (Task.Active)
Task.Run(true);
}
{
var Task = NetworkSuite.Jobs(0).Tasks.ItemByName("Task1");
if (Task.Active)
Task.Run(true);
}
Python
def Test():
Task = NetworkSuite.Jobs.Items[0].Tasks.ItemByName["Task1"]
if Task.Active:
Task.Run(True)
VBScript
Sub Test
Set Task = NetworkSuite.Jobs(0).Tasks.ItemByName("Task1")
If Task.Active Then
Task.Run(True)
End If
End Sub
Set Task = NetworkSuite.Jobs(0).Tasks.ItemByName("Task1")
If Task.Active Then
Task.Run(True)
End If
End Sub
DelphiScript
procedure Test;
var Task : OleVariant;
begin
Task := NetworkSuite.Jobs[0].Tasks.ItemByName['Task1'];
if Task.Active then
Task.Run(True);
end;
var Task : OleVariant;
begin
Task := NetworkSuite.Jobs[0].Tasks.ItemByName['Task1'];
if Task.Active then
Task.Run(True);
end;
C++Script, C#Script
function Test()
{
var Task = NetworkSuite["Jobs"](0)["Tasks"]["ItemByName"]("Task1");
if (Task["Active"])
Task["Run"](true);
}
{
var Task = NetworkSuite["Jobs"](0)["Tasks"]["ItemByName"]("Task1");
if (Task["Active"])
Task["Run"](true);
}