Function Repository Resource:

SessionHistoryNotebook

Source Notebook

Create a notebook containing all inputs and outputs from the current kernel session

Contributed by: Jon McLoone

ResourceFunction["SessionHistoryNotebook"][]

creates a notebook containing all inputs and outputs from the current kernel session.

Details and Options

If you close a notebook without saving or have repeatedly edited inputs or evaluated inputs out of order, then you do not have an accurate notebook record of the calculations performed. ResourceFunction["SessionHistoryNotebook"] will create that record in a fresh notebook by examining the kernel history.
If you quit the kernel or use Quit, then ResourceFunction["SessionHistoryNotebook"] will not be able to recover any inputs. If you change the values of $Line or $HistoryLength, the document created by ResourceFunction["SessionHistoryNotebook"] may not be complete or may not be correctly ordered.

Examples

Basic Examples (3) 

Do some evaluation:

In[1]:=
1 + 1
Out[1]=

Create a notebook with history for the current session:

In[2]:=
ResourceFunction["SessionHistoryNotebook"][]
Out[2]=

The created notebook contains the history:

Options (1) 

SessionHistoryNotebook[] returns both inputs and outputs. If you are only interested in the inputs of the session, you can use the option "IncludeOutput“False:

In[3]:=
ResourceFunction["SessionHistoryNotebook"]["IncludeOutputs" -> False]
Out[3]=

Publisher

Jon McLoone

Version History

  • 1.0.0 – 01 April 2022

Related Resources

License Information