({{, RemoveScheduledTask[obj] 
removes obj from the list of currently scheduled local or cloud tasks.}})

OpenersNotesSection(Spacer1)Details

obj can be a (RefLink[ScheduledTaskObject, paclet:ref/ScheduledTaskObject]) expression, or a (RefLink[CloudObject, paclet:ref/CloudObject]) containing a (RefLink[ScheduledTask, paclet:ref/ScheduledTask]) expression or (RefLink[DocumentGenerator, paclet:ref/DocumentGenerator]).

For scheduled tasks in the cloud, RemoveScheduledTask is effectively equivalent to (RefLink[DeleteFile, paclet:ref/DeleteFile])[(RefLink[CloudObject, paclet:ref/CloudObject])[…]].

RemoveScheduledTask returns a single (RefLink[ScheduledTaskObject, paclet:ref/ScheduledTaskObject]) or (RefLink[CloudObject, paclet:ref/CloudObject]) expression or a list of expressions that have been removed.

RemoveScheduledTask has attribute (RefLink[Listable, paclet:ref/Listable]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (7)

OpenersExampleSection0(Spacer1)Basic Examples  (7)

Create a task that removes itself:

RunScheduledTask[RemoveScheduledTask[$ScheduledTask]]

Create a task:

n = 0; RunScheduledTask[n++, {1, 3}];

n

ScheduledTasks[]

Remove the task:

RemoveScheduledTask[ScheduledTasks[]]

Remove the task automatically when it is not needed:

RunScheduledTask[x=DateString[]];

ScheduledTasks[]

Dynamic[x]

RunScheduledTask[x=Graphics[{Red,Disk[]}];RemoveScheduledTask[$ScheduledTask],2];

The second task was automatically removed:

ScheduledTasks[]

RemoveScheduledTask[ScheduledTasks[]];

Non-synchronized tasks:

i=0;
RunScheduledTask[++i, 1];
RunScheduledTask[i=0,4];
Dynamic[i]

Better synchronization:

j=0;
StartScheduledTask[{CreateScheduledTask[++j, 1],CreateScheduledTask[j=0,4]}];
Dynamic[j]

ScheduledTasks[]

RemoveScheduledTask[ScheduledTasks[]];

Create a task that runs only once and removes itself after finishing:

RunScheduledTask[Print[RandomReal[]];RemoveScheduledTask[$ScheduledTask],0];

ScheduledTasks[]

Create a task that removes itself once a condition is met:

RunScheduledTask[With[{x=RandomReal[]},Print[x];If[x>0.6,RemoveScheduledTask[$ScheduledTask]]],1];

Create a task that removes itself when an external variable is changed:

x=0;RunScheduledTask[Print[RandomReal[]];If[x≥1,RemoveScheduledTask[$ScheduledTask]],1];

Cause the task to be stopped and removed:

x=1

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ScheduledTask, paclet:ref/ScheduledTask])  ▪  (RefLink[DocumentGenerator, paclet:ref/DocumentGenerator])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Date and Time Functions, paclet:tutorial/DateAndTimeFunctions])}, {▪(RefLinkPlain[Controlling Infinite Evaluation, paclet:tutorial/ControllingInfiniteEvaluation])}})}})