SelectionEvaluate

SelectionEvaluate[notebook]
replaces the current selection in a notebook with the result obtained by evaluating the contents of the selection in the kernel.

SelectionEvaluate[notebook,sel]
sets the current selection after the evaluation to be as specified by sel.

DetailsDetails

  • The first argument of SelectionEvaluate is a NotebookObject.
  • Possible settings for sel are as in NotebookWrite.
  • The default for sel is After.
  • Unless sel is None, the current selection after evaluation is complete will always be as specified by sel, even if you moved the selection interactively in the front end during the course of the evaluation.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Create a notebook and select an expression within it:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Evaluate the expression in place:

In[3]:=
Click for copyable input
Introduced in 1996
(3.0)