What you could use is NotebookFind
to search inside your notebook for something unique which distinguishes your Button
from all other.
Here I looked at the cell-structure of your Button
and used it to make a small function which creates exactly this button-cell with the exception, that it adds a CellTag
. The Button
itself just searches for this CellTag
and selects the Cell
where it is found. As a unique string I used simply the creation-time of the button:
MakeSelectionButton[] := With[{t = DateString[]},
CellPrint@Cell[BoxData[
ButtonBox["\<\"Select this cell\"\>",
Appearance -> Automatic,
ButtonFunction :> NotebookFind[
ButtonNotebook[], t, All, CellTags],
Evaluator -> Automatic,
Method -> "Preemptive"]], "Output", CellTags -> t]
]
MakeSelectionButton[]