I think I am lost on some basic issue ...
I created two CellTags, tagone and tagtwo
If I create this palette inputting the following code by hand I get a beautifully working palette that makes me jump to these cells.
CreatePalette[{
Button["tagone", NotebookFind[InputNotebook[], "tagone", All, CellTags]],
Button["tagtwo", NotebookFind[InputNotebook[], "tagtwo", All, CellTags]]}]
If I do put this in a function like the following the palette gets created with right names shown in the buttons, but pressing the buttons nothing happens ...
Apparently there is a problem in this code with the use of the counter variable in the For
. In this examples it is called celln
and in the error monitor I get
Part specification celln$53002 is neither a machine-sized integer nor a list of machine-sized integers.
I though the variables was fixed in the loop ... I am quite puzzled, any guess? Did I just made a rookie mistake? I think this functions was previously working when I originally developed it in December. Maybe my memory is failing.
Module[{nb, res, list, origlist, celln},
nb = InputNotebook[];
origlist = NotebookTools`NotebookCellTags[nb];
Print[origlist];
res = {};
For[celln = 1, celln <= Length[origlist], celln++,
Print[ToString[origlist[[celln]]]];
AppendTo[res,
Button[origlist[[celln]],
NotebookFind[nb, origlist[[celln]], All, CellTags, AutoScroll -> True]]];
];
CreatePalette[res];
]
nb
and the one for the name of the tag are messed up ... $\endgroup$ – Rho Phi Feb 11 '14 at 3:17