... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Iterating Through Mathematica Notebook Cells

The following snippet will iterate through the all the cells in a Mathematica notebook and close all Input cells:

Module[{nb, cell},
 nb = Notebooks["mynotebook.nb"][[1]];
 SelectionMove[nb, Before, Notebook];
 While[SelectionMove[nb, Next, Cell]; cell=NotebookRead[nb]; {}=!=cell,
  If["Input" == cell[[2]], 
   SetOptions[NotebookSelection[nb], "CellOpen" -> True] ]

Blog Archive