How do I execute code on save?
This is a similar question: Running a package automatically when it's saved
How do I execute code on save?
This is a similar question: Running a package automatically when it's saved
Evaluating the following in a notebook will place a "toolbar" as a DockedCell with a Save and Run button:
SetOptions[EvaluationNotebook[], DockedCells -> Cell[BoxData[ToBoxes[ Row[ {Button["Save and Run", Module[{}, FrontEndTokenExecute[ButtonNotebook[], "Save"]; NotebookFind[ButtonNotebook[], "Input", All, CellStyle]; FrontEndTokenExecute[ButtonNotebook[], "EvaluateCells"] ] ]}, ImageSize -> Full, Alignment -> Right ] ]], "DockedCell" ] ] Afterwards, you can delete the above code, and then pressing this button will save the notebook before evaluating "Input" Cells.