TaskState Function

Returns the current state of a task.

Syntax
TaskState( taskIdentifier )

Parameters

taskIdentifier
Specify the task name or task number as an integer value. A task name is the function name used in an Xqt statement or a function started from the Run window or Operator window.
Task number (integer) range is as follows:

  • Normal tasks: 1 to 32
  • Background task: 65 to 80
  • Trap tasks: 257 to 267

Return Values

  • 0: Task not running
  • 1: Task is running
  • 2: Task is waiting for an event
  • 3: Task has been halted
  • 4: Task has been paused in QuickPause
  • 5: Task in error condition

Description
Use TaskState to get status for a given task. You can specify task number or task name.

See Also
TaskDone, TaskWait

TaskState Function Example

If TaskState(conveyor) = 0 Then
    Xqt 2, conveyor
EndIf