Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a notebook, with functions. The only thing that I want to change in the notebook later is the input file. I therefor want to have a button that runs every input step-by-step so that I do not have to go into every input and press enter for it to update. How could this be done.

share|improve this question
If you're using Windows, why not CTRL+A and then SHIFT+ENTER ? – Rod Aug 31 '13 at 23:04
up vote 6 down vote accepted

Perhaps the simplest thing is to command-A and enter, which selects all the cells and evaluates. Or you can use a button

evalStart := Module[{}, 
    FrontEndExecute[FrontEndToken[InputNotebook[], "EvaluateInitialization"]];
    FrontEndExecute[FrontEndToken[InputNotebook[], "SelectAll"]];
    FrontEndExecute[FrontEndToken[InputNotebook[], "EvaluateCells"]];];
Button["do it", evalStart]

When you evaluate this, a button appears. Every time you press the button, it evaluates everything by first evaluating the initialization cells (if any), then selecting all, then evaluating all the cells.

enter image description here

share|improve this answer
Why not to simply use the FrontEndExecute[FrontEndToken[InputNotebook[], "EvaluateNotebook"]]? Anyway, good solution! – m0nhawk Sep 1 '13 at 5:40

There is a Evaluation -> Evaluate Notebook menu for that.

Or, you can set some cells to have Initialization property (documentation on usage).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.