Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nb = Notebook[{Cell[
- CellGroupData[{Cell[
- BoxData[{RowBox[{RowBox[{"Print", "[",
- RowBox[{"Button", "[",
- RowBox[{"\"Print Cell\"", ",",
- RowBox[{"Cell", "[",
- RowBox[{RowBox[{"BoxData", "[",
- RowBox[{"ToBoxes", "@",
- RowBox[{"First", "@",
- RowBox[{"Cases", "[",
- RowBox[{RowBox[{RowBox[{"NotebookGet", "[",
- RowBox[{"EvaluationNotebook", "[", "]"}], "]"}],
- "[", RowBox[{"[", "1", "]"}], "]"}], ",",
- RowBox[{"Cell", "[",
- RowBox[{"___", ",",
- RowBox[{"CellTags", "\[Rule]", "\"MyCode\""}],
- ",", "___"}], "]"}]}], "]"}]}]}], "]"}], ",",
- "\"Input\"", ",",
- RowBox[{"CellTags", "\[Rule]",
- "\"MyGraphic\""}]}], "]"}]}], "]"}], "]"}], ";"}],
- "\n", RowBox[{RowBox[{"CellPrint", "@",
- RowBox[{"Cell", "[",
- RowBox[{RowBox[{"BoxData", "[",
- RowBox[{"ToBoxes", "[",
- RowBox[{RowBox[{"Cases", "[",
- RowBox[{RowBox[{"NotebookGet", "[",
- RowBox[{"EvaluationNotebook", "[", "]"}], "]"}],
- ",", RowBox[{"Cell", "[",
- RowBox[{"___", ",",
- RowBox[{"CellTags", "\[Rule]", "\"MyGraphic\""}],
- ",", "___"}], "]"}], ",", "Infinity"}], "]"}],
- ",", "StandardForm"}], "]"}], "]"}], ",",
- "\"Output\"", ",",
- RowBox[{"CellTags", "\[Rule]", "\"MyCode\""}]}],
- "]"}]}], ";"}]}], "Input",
- CellChangeTimes -> {{3.5849762872579813`*^9,
- 3.584976287259982`*^9}}],
- Cell[BoxData[
- ButtonBox["\"Print Cell\"", Appearance -> Automatic,
- ButtonFunction :>
- Cell[BoxData[
- ToBoxes[
- First[Cases[NotebookGet[EvaluationNotebook[]][[1]],
- Cell[___, CellTags -> "MyCode", ___]]]]], "Input",
- CellTags -> "MyGraphic"], Evaluator -> Automatic,
- Method -> "Preemptive"]], "Print",
- CellChangeTimes -> {3.584976288767068`*^9}],
- Cell[BoxData[
- RowBox[{StyleBox[RowBox[{"First", "::", "first"}],
- "MessageName"], RowBox[{":", " "}],
- "\"\[NoBreak]\\!\\({}\\)\[NoBreak] has a length of zero \
- and no first element. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \
- ButtonStyle->\\\"Link\\\", ButtonFrame->None, \
- ButtonData:>\\\"paclet:ref/message/First/first\\\", ButtonNote -> \
- \\\"First::first\\\"]\\)\""}]], "Message", "MSG",
- CellChangeTimes -> {3.584976288780069`*^9}],
- Cell[BoxData[
- RowBox[{"{",
- RowBox[{"Cell", "[",
- RowBox[{RowBox[{"BoxData", "[",
- RowBox[{"RowBox", "[",
- RowBox[{"{",
- RowBox[{"\"First\"", ",", "\"[\"", ",",
- RowBox[{"RowBox", "[",
- RowBox[{"{", RowBox[{"\"{\"", ",", "\"}\""}],
- "}"}], "]"}], ",", "\"]\""}], "}"}], "]"}], "]"}],
- ",", "\"Input\"", ",",
- RowBox[{"CellTags", "\[Rule]", "\"MyGraphic\""}]}],
- "]"}], "}"}]], "Output",
- CellChangeTimes -> {3.5849762887850695`*^9},
- CellTags -> "MyCode"]}, Open]]}, WindowSize -> {707, 525},
- WindowMargins -> {{Automatic, 40}, {2, Automatic}},
- FrontEndVersion ->
- "8.0 for Microsoft Windows (32-bit) (February 23, 2011)",
- StyleDefinitions -> "Default.nb"];
- Cases[nb, Cell[__, CellTags -> "MyGraphic"], Infinity]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement