I'm developing a package that needs to exert significant control over a notebook while a user interacts with it. One specific thing that it needs to do, programmatically, is to select a specific subset of Input cells in order to do things to them -- set cell options, check their contents, etc. I can't figure out how to do this.
One solution that occurred to me is to apply a
CellTag to those Input cells, so that I can select them with
NotebookLocate. The problem with this strategy is that whenever any of these Input cells are evaluated, the corresponding Output cells inherit the tag. So, my
NotebookFind will select both the Input cells I want and these new Output cells I don't. I could instead have
NotebookFind locate all Input cells, but as far as I can tell there's no way to say "Find all cells of type Input with tag XXX."
NotebookFind won't accept multiple search criteria, and can't be limited to currently-selected cells.
Another potential solution is to create a new kind of cell that functions just like an Input cell, and make all the cells I want to find be of this cell style. Unfortunately, I haven't had any luck "subclassing" the Input cell style this way, or finding any information about how to do that. It seems that if I want a cell to behave like an Input cell, it has to be an Input cell.
Can anyone wiser than I suggest a way to designate, and later to programmatically select, a subset of Input cells?