5
$\begingroup$

How can I create the "Run all code" button (at the top right corner) in Mathematica notebook?

The current method I have is to save the .nb file into .wls (i.e. Wolfram Language Script), and then open the .wls file (which have a "Run all code" button at the top right corner) and save it back to .nb file. But this method seems silly and clumsy and I wonder if there's a better method to do it.

$\endgroup$
  • 1
    $\begingroup$ You can also go into the "Evaluation" menu and click on "Evaluate Notebook"... $\endgroup$ – Henrik Schumacher Apr 23 '18 at 22:26
7
$\begingroup$

Here is some code I wrote to make a palette that I use a lot. Maybe the it will work you, or at least give you ideas on how to do it.

CreatePalette[
  Framed @ Column[{
     Button["Evaluate Cells", 
       FrontEndExecute[FrontEndToken["EvaluateCells"]], 
       Appearance -> "Palette", ImageSize -> 140],
     Button["Evaluate Notebook", 
       FrontEndExecute[FrontEndToken["EvaluateNotebook"]], 
       Appearance -> "Palette", ImageSize -> 140],
     Button["Global Clear", Clear["Global`*"],
       Appearance -> "Palette", ImageSize -> 140]}],
  WindowTitle -> "Evaluation"];

palette

If you need instructions on how to install the palette, look at this answer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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