Function Repository Resource:

SetNotebookAutoSaveTime

Source Notebook

Set a notebook to auto-save periodically

Contributed by: Jon McLoone

ResourceFunction["SetNotebookAutoSaveTime"][]

sets the EvaluationNotebook to auto-save every 60 seconds.

ResourceFunction["SetNotebookAutoSaveTime"][n]

sets the EvaluationNotebook to auto-save every n seconds.

ResourceFunction["SetNotebookAutoSaveTime"][nb,n]

auto-saves the Notebook nb.

ResourceFunction["SetNotebookAutoSaveTime"][nb,quantity]

auto-saves nb each period of quantity time.

Details

Notebooks only auto-save if they have been saved once and have changed in memory.
The value of the Notebook option NotebookDynamicExpression will be discarded when ResourceFunction["SetNotebookAutoSaveTime"] is used.
This periodic notebook saving is independent of use of the Notebook option NotebookAutoSave.
Auto-saving overwrites the previous file, which cannot be retrieved.
When opened in a future session, the notebook will retain its auto-save property until canceled with ResourceFunction["SetNotebookAutoSaveTime"][None].

Examples

Basic Examples (3) 

Set this notebook to auto-save every 60 seconds:

In[1]:=
ResourceFunction["SetNotebookAutoSaveTime"][]

Change the auto-save period to five minutes:

In[2]:=
ResourceFunction["SetNotebookAutoSaveTime"][300]

Cancel the operation by setting the period to None:

In[3]:=
ResourceFunction["SetNotebookAutoSaveTime"][None]

Scope (2) 

Change the auto-save period to five minutes:

In[4]:=
ResourceFunction["SetNotebookAutoSaveTime"][Quantity[5, "Minutes"]]

Create a notebook that will auto-save regularly (note that this will not take effect until the notebook has been saved for the first time):

In[5]:=
nb = NotebookCreate[];
ResourceFunction["SetNotebookAutoSaveTime"][nb, 300];

Publisher

Jon McLoone

Version History

  • 1.0.0 – 15 November 2021

License Information