$CurrentTask

$CurrentTask

gives the TaskObject[] corresponding to the task in which it is being evaluated.

Details

  • $CurrentTask is set to the current TaskObject when evaluated within the task object or within a handler function for events generated by the task.
  • If evaluated not within a task object, $CurrentTask gives None.

Examples

Basic Examples  (4)

Create a task and show available properties:

In[1]:=
Click for copyable input
Out[1]=

Display task's identifier:

In[1]:=
Click for copyable input
Out[1]=

Print task's current status:

In[1]:=
Click for copyable input
Out[1]=

Print run counts of the task:

In[1]:=
Click for copyable input
Out[1]=

Print previous and remaining run counts using $CurrentTask:

In[2]:=
Click for copyable input
Out[2]=

See Also

TaskObject  HandlerFunctions  $EvaluationCloudObject  $EvaluationEnvironment

Introduced in 2017
(11.2)