3
How about this?:
format[l_List] :=
ToBoxes@# /. {"set", "[", RowBox[{a_, ",", b_}], "]"} :> {a, "=", b, ";", "\n"} & /@
l // RowBox // BoxData // Cell[#, "Code"] & // CellPrint;
format@{set[a, 1], set[b, 2], set[c, 2]}
3
You could try the following approach, with a secondary kernel (K2) and using CellInformation to check if a cell or notebook is currently in the "Evaluating" state:
Get the current evaluator names:
evaluators = EvaluatorNames /. Options[$FrontEnd, EvaluatorNames];
Add a "K2" kernel if there isn't one:
SetOptions[$FrontEnd, Union[Join[...
2
An example of evaluating the expression outside the notebook and then write the result in the notebook.
exampleNB = CreateDocument[];
NotebookWrite[exampleNB,
Cell["example of evaluating input programmatically",
"Text"]]; NotebookWrite[exampleNB,
Cell["D[Sin[ RandomReal[] x],x]", "Input", CellTags -> 1]];
...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
notebooks × 1067front-end × 321
cells × 157
formatting × 71
options × 64
evaluation × 58
stylesheet × 57
customization × 56
export × 51
bugs × 34
programming × 29
dynamic × 28
files-and-directories × 27
keyboard × 24
boxes × 24
import × 22
style × 22
gui-construction × 20
output-formatting × 18
packages × 18
user-interface × 18
save × 18
graphics × 17
kernel × 17
documentation × 17