Function Repository Resource:

SimulatedTyping

Source Notebook

Write contents into a notebook one character at a time, as if being typed by a human

Contributed by: Jon McLoone

ResourceFunction["SimulatedTyping"][contents]

writes contents into the selected notebook one character at a time.

ResourceFunction["SimulatedTyping"][nb,contents]

writes contents into the notebook nb one character at a time.

Details and Options

The principal purpose is to be able to create reproducible scripts for screen recordings and similar demos.
ResourceFunction["SimulatedTyping"] accepts the following options:
"Delay"0.06the average delay, in seconds, between characters
"EvaluateInput"Truewhether to evaluate Input cells upon completion
AutoScrollTruewhether a notebook should automatically be scrolled to display the current selection
"PauseCharacter""⏸"the character designated to represent an additional one second delay
On slower computers, the typing rate specified by "Delay" may not be achieved.
Changing the insertion point by clicking in the notebook, or using the arrow keys, will cause the order of contents to change in the output.

Examples

Basic Examples (2) 

Text is written one character at a time:

In[1]:=
ResourceFunction["SimulatedTyping"]["Hello world!"]

Cells are created first with all specified options and then populated one character at a time:

In[2]:=
ResourceFunction["SimulatedTyping"][Cell["Hello world!", "Text"]]

Hello world!

Scope (2) 

Some 2D box structures are supported:

In[3]:=
ResourceFunction["SimulatedTyping"][MakeBoxes[x^y + Sqrt[t/y]]]
In[4]:=
ResourceFunction["SimulatedTyping"][
 MakeBoxes[MatrixForm[{{1, 2}, {3, 4}}]]]

If SimulatedTyping is applied to a Notebook, then a new wIndow is created using the Notebook options of the source notebook:

In[5]:=
ResourceFunction["SimulatedTyping"][NotebookGet[EvaluationNotebook[]],
  "EvaluateInput" -> False]

Options (4) 

You can make the simulated typing slower by increasing "Delay":

In[6]:=
ResourceFunction["SimulatedTyping"][
 Cell["This is slow typing", "Text"], "Delay" -> 0.25]

This is slow typing


You can add additional pauses with the "PauseCharacter" option. The pause character causes a one second delay and is not included in the output:

In[7]:=
ResourceFunction["SimulatedTyping"][
 Cell["The answer is\[Ellipsis]⏸⏸⏸YES!", "Text"]]

The answer is…YES!


Specify a different pause character:

In[8]:=
ResourceFunction["SimulatedTyping"][
 Cell["The answer is\[Ellipsis]:::YES!", "Text"], "PauseCharacter" -> ":"]

The answer is…YES!


With the option "EvaluateInput"True, any output cells are ignored and instead are recreated by evaluating the input expressions:

In[9]:=
ResourceFunction["SimulatedTyping"][
 Notebook[{Cell["This will be different every time", "Text"], Cell[BoxData[{"RandomReal[]"}], "Input"], Cell[BoxData[{"0.2222222"}], "Output"]}], "EvaluateInput" -> True]
Out[9]=

With the option "EvaluateInput"False, output cells are copied in a single write into the target notebook:

In[10]:=
ResourceFunction["SimulatedTyping"][
 Notebook[{Cell["This will be the same every time", "Text"], Cell[BoxData[{"RandomReal[]"}], "Input"], Cell[BoxData[{"{0.1111111}"}], "Output"]}], "EvaluateInput" -> False]
Out[10]=

Possible Issues (2) 

Contents should be Notebook, Cell, boxes or strings. Other expressions will mostly be converted to FullForm:

In[11]:=
ResourceFunction["SimulatedTyping"][1/2]

Not all notebook contents are supported. If unsupported contents are encountered, they are inserted in a single step:

In[12]:=
ResourceFunction["SimulatedTyping"][ToBoxes@\!\(\*
GraphicsBox[
TagBox[RasterBox[CompressedData["
1:eJxlmdd3FVeWxnvNvMzjvExye6bd7rabKFAOKKCAUEASoAAY6B5MNthggmU1
RoBAOedwdYOuws05Vc7xJkmAjN2rX2b1mv9jzqm6ErhnrY+zSvCgH9+3a1ft
Xb/98t7ZG//wq1/96uE/gePslc7KBw+udLX+M/ih/ZuHt29+c/1a/TePrt+8
/qDoy38Ef5mT+QOvJya+mpm5M2/4ZtF037D6wGR7ZHF2Wj1d64EntvBTe+SZ
M/bcjfV4sFdevN9LDvjJwQA1HKBGgIL0aIieCDOTUXYW4RcRfgnhDYiwjPBG
hDehgiYeCuFMMc6IsCaEMcZoA1CUgooQCyF0NhSbDkSmXN4B28bzdWv3+sqT
maVbC8bbhrWvjbb7FteDVd/jtWDneqjLHn3iRJ66sOdeosdHvfJRvQG6P8AM
htihMDeiaTTMjUW4iSg/FROmEXEWFecQqAVUWEDFRUxaghINQKiwhAiLKL+I
cosIu4BwCwgDNB+lZ8PkTBibCiDj3tCg29/n8f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umOMMdExc
2AUzUvrnEsmiCYKR8hqlgyl26NiH0ggzUl2M4twTC2VnZZuGtMbyVpazsIwl
EHjo834XCHSBso8gz6LYS2AXBuxiANgowYH7UXdshhTmSRE6Br9TSMvwu4Bo
IrXPW/DbFnBMXss4Bk2z0YrmWwYSfpjISLYzsm33BDxA68AlVlhlABJrYhmz
z/vA637s83cGAVUMUPWAZxAIEYV2jeLcBNyUclMEpJrNVL5ml06lfXQz61TQ
LlmrfxmCaTx2eCoOKJ1QsTNKhoeRNxh5nZU3NKpVVrAy3IpGZfw/XZQ2TQ==

"], {{0, 50.}, {50., 0}}, {0, 255},
ColorFunction->RGBColor],
BoxForm`ImageTag[
      "Byte", ColorSpace -> "RGB", Interleaving -> True, MetaInformation -> <|"Comments" -> <|"Software" -> "Wolfram Mathematica 8.0", "Creation Time" -> DateObject[{2010, 2, 18, 12, 43, 31.}, "Instant"]|>|>],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSizeRaw->{50., 50.},
PlotRange->{{0, 50.}, {0, 50.}}]\)]

Publisher

Jon McLoone

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.2.1 – 29 March 2024
  • 1.2.0 – 18 October 2023
  • 1.1.0 – 20 September 2023
  • 1.0.0 – 23 June 2022

Related Resources

License Information