({{, ResetScheduledTask[obj,timespec] 
resets the timing for a scheduled task to timespec.}, {, ResetScheduledTask[obj,timespec,offset]
resets the time offset for a scheduled task to offset.}})

OpenersNotesSection(Spacer1)Details and Options

ResetScheduledTask returns a single (RefLink[ScheduledTaskObject, paclet:ref/ScheduledTaskObject])  expression or a list of expressions.

ResetScheduledTask stops the task if it was running.

When the task is reset, the time until the next activation is set to the full time interval.

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

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Reset and restart the timer after it is expired:

n=0;Dynamic[n]
t=RunScheduledTask[n++,{1,2}];

ScheduledTasks[]

StartScheduledTask[ResetScheduledTask[t]]

Pause[2];n

RemoveScheduledTask[ScheduledTasks[]];

Reset the timer before its expiration:

n=0;Dynamic[n]

t=RunScheduledTask[n++,{1,10}];

Pause[3];StartScheduledTask[ResetScheduledTask[t]];

RemoveScheduledTask[ScheduledTasks[]];

Create a task with random wait periods:

time:=RandomInteger[{1,3}]

fun[t_]:=Print["Waiting ",t," seconds."]

RunScheduledTask[With[{t=time},ResetScheduledTask[$ScheduledTask,{t}];fun[t];StartScheduledTask[$ScheduledTask]],{1}];

RemoveScheduledTask[ScheduledTasks[]];

Create a task that restarts evaluation as soon as it finishes:

fun:=With[{t=RandomInteger[{1,3}]},Print["Waiting ",t," seconds."];Pause[t]]

RunScheduledTask[fun;StartScheduledTask[$ScheduledTask],{1}];

RemoveScheduledTask[ScheduledTasks[]];

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

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