CreateScheduledTask

CreateScheduledTask is being phased out in favor of SessionSubmit, which was introduced experimentally in Version 11.2.

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)

Create a task:

Start the task:

Stop and remove it:

Create a task, which will evaluate x every second:

Assign value to x:

Start the task:

Create a task that will be activated 5 seconds from the current time and will print 1 second later:

Specify a date to activate the task:

Non-synchronized tasks:

Better synchronization:

Synchronize tasks using an auxiliary task:

The auxiliary task x1 was removed:

Stop tasks:

Remove all tasks:

Wolfram Research (2010), CreateScheduledTask, Wolfram Language function, https://reference.wolfram.com/language/ref/CreateScheduledTask.html (updated 2014).

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_2024_createscheduledtask, author="Wolfram Research", title="{CreateScheduledTask}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CreateScheduledTask.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_createscheduledtask, organization={Wolfram Research}, title={CreateScheduledTask}, year={2014}, url={https://reference.wolfram.com/language/ref/CreateScheduledTask.html}, note=[Accessed: 18-November-2024 ]}