Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
2  
If you're using Windows, why not CTRL+A and then SHIFT+ENTER ? –  Rod Aug 31 '13 at 23:04
add comment

2 Answers 2

up vote 5 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
add comment

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
add comment

Your Answer

 
discard

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.