CreateScheduledTask[expr]
creates a local scheduled task that will repeatedly evaluate expr once per second.
CreateScheduledTask[expr,time]
creates a task that will repeatedly evaluate expr every time seconds.
CreateScheduledTask[expr,{time}]
creates a task that will evaluate expr once after time seconds.
CreateScheduledTask[expr,{time,count}]
creates a task that will try evaluating expr once every time seconds up to count times total.
CreateScheduledTask[expr,timespec,start]
creates a task that will evaluate expr according to timespec starting at start time.
CreateScheduledTask
CreateScheduledTask[expr]
creates a local scheduled task that will repeatedly evaluate expr once per second.
CreateScheduledTask[expr,time]
creates a task that will repeatedly evaluate expr every time seconds.
CreateScheduledTask[expr,{time}]
creates a task that will evaluate expr once after time seconds.
CreateScheduledTask[expr,{time,count}]
creates a task that will try evaluating expr once every time seconds up to count times total.
CreateScheduledTask[expr,timespec,start]
creates a task that will evaluate expr according to timespec starting at start time.
Details and Options
- CreateScheduledTask returns a ScheduledTaskObject expression representing the created task.
- CreateScheduledTask creates a task, but does not start it. The task can be started using StartScheduledTask.
- CreateScheduledTask creates a task to be run locally in the current Wolfram Language session. No task state is preserved between sessions.
- The start is taken to be the absolute time when the task is activated.
- The first evaluation of expr will occur time seconds after it is activated.
- If two tasks are scheduled to evaluate at the same time, the one added later will execute first.
- Scheduled tasks do not require a notebook front end to work.
- By default, if the time necessary to evaluate expr is larger than time, the next pending evaluation is skipped.
Examples
Basic Examples (6)
t = CreateScheduledTask[Print[DateString[]]]StartScheduledTask[t]RemoveScheduledTask[t]Create a task, which will evaluate x every second:
t = CreateScheduledTask[x]x := Print[DateString[]];StartScheduledTask[t]RemoveScheduledTask[t]Create a task that will be activated 5 seconds from the current time and will print 1 second later:
RunScheduledTask[MessageDialog["text"], {1}, AbsoluteTime[] + 5]Specify a date to activate the task:
RunScheduledTask[MessageDialog["text"], {1}, AbsoluteTime[{2010, 3, 12, 15, 16, 0}]]i = 0;
RunScheduledTask[++i, 1];
RunScheduledTask[i = 0, 4];
Dynamic[i]j = 0;
StartScheduledTask[{CreateScheduledTask[++j, 1], CreateScheduledTask[j = 0, 4]}];
Dynamic[j]RemoveScheduledTask[ScheduledTasks[]];Synchronize tasks using an auxiliary task:
n = 1;Dynamic[FlipView[{Graphics[{Red, Disk[]}], Graphics[{Green, Disk[]}]}, n]]x1 = CreateScheduledTask[StartScheduledTask[{x3}];RemoveScheduledTask[$ScheduledTask], {0.3}];
x2 = CreateScheduledTask[n = 1, 1];
x3 = CreateScheduledTask[n = 2, 1];ScheduledTasks[]StartScheduledTask[{x1, x2}];The auxiliary task x1 was removed:
ScheduledTasks[]StopScheduledTask[ScheduledTasks[]];RemoveScheduledTask[ScheduledTasks[]];See Also
Tech Notes
Text
Wolfram Research (2010), CreateScheduledTask, Wolfram Language function, https://reference.wolfram.com/language/ref/CreateScheduledTask.html (updated 2014).
CMS
Wolfram Language. 2010. "CreateScheduledTask." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/CreateScheduledTask.html.
APA
Wolfram Language. (2010). CreateScheduledTask. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CreateScheduledTask.html
BibTeX
@misc{reference.wolfram_2026_createscheduledtask, author="Wolfram Research", title="{CreateScheduledTask}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CreateScheduledTask.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_createscheduledtask, organization={Wolfram Research}, title={CreateScheduledTask}, year={2014}, url={https://reference.wolfram.com/language/ref/CreateScheduledTask.html}, note=[Accessed: 15-June-2026]}