Description
The Stop method stops executing the given job unconditionally.
Declaration
JobObj.Stop()
| JobObj | An expression, variable or parameter that specifies a reference to a Job object | |||
| Result | None | |||
Applies To
The method is applied to the following object:
Result Value
None.
Remarks
You cannot stop the job from the OnNetJobStateChange, OnNetSuiteStateChange and OnNetTaskStateChange event handlers.
Example
The following script stops job execution if it does not stop at the specified time.
JavaScript, JScript
function StopJobExample()
{
// Specifies the name of a job
var jName = "Job_Name";
// Obtains the job by its name
var Job = NetworkSuite.Jobs.ItemByName(jName);
// ...
if (! Job.WaitForState(ns_Idle, 600000) ) then
Job.Stop();
}
Python
def StopJobExample():
# Specifies the name of a job
jName = "Job_Name"
# Obtains the job by its name
Job = NetworkSuite.Jobs.ItemByName[jName]
# ...
if not Job.WaitForState(ns_Idle, 600000):
Job.Stop()
VBScript
Sub StopJobExample()
' Specifies the name of a job
jName = "Job_Name"
' Obtains the job by its name
Set Job = NetworkSuite.Jobs.ItemByName(jName)
' ...
If Not Job.WaitForState(ns_Idle, 600000) Then
Job.Stop
End If
End Sub
DelphiScript
function StopJobExample;
var jName, Job;
begin
// Specifies the name of a job
jName := 'Job_Name';
// Obtains the job by its name
Job := NetworkSuite.Jobs.ItemByName[jName];
// ...
if not Job.WaitForState(ns_Idle, 600000) then
Job.Stop;
end;
C++Script, C#Script
function StopJobExample()
{
// Specifies the name of a job
var jName = "Job_Name";
// Obtains the job by its name
var Job = NetworkSuite["Jobs"]["ItemByName"](jName);
// ...
if (! Job["WaitForState"](ns_Idle, 600000) ) then
Job["Stop"]();
}
