Advertisement
Guest User

Untitled

a guest
Aug 8th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. nb = Notebook[{Cell[
  2. CellGroupData[{Cell[
  3. BoxData[{RowBox[{RowBox[{"Print", "[",
  4. RowBox[{"Button", "[",
  5. RowBox[{"\"Print Cell\"", ",",
  6. RowBox[{"Cell", "[",
  7. RowBox[{RowBox[{"BoxData", "[",
  8. RowBox[{"ToBoxes", "@",
  9. RowBox[{"First", "@",
  10. RowBox[{"Cases", "[",
  11. RowBox[{RowBox[{RowBox[{"NotebookGet", "[",
  12. RowBox[{"EvaluationNotebook", "[", "]"}], "]"}],
  13. "[", RowBox[{"[", "1", "]"}], "]"}], ",",
  14. RowBox[{"Cell", "[",
  15. RowBox[{"___", ",",
  16. RowBox[{"CellTags", "\[Rule]", "\"MyCode\""}],
  17. ",", "___"}], "]"}]}], "]"}]}]}], "]"}], ",",
  18. "\"Input\"", ",",
  19. RowBox[{"CellTags", "\[Rule]",
  20. "\"MyGraphic\""}]}], "]"}]}], "]"}], "]"}], ";"}],
  21. "\n", RowBox[{RowBox[{"CellPrint", "@",
  22. RowBox[{"Cell", "[",
  23. RowBox[{RowBox[{"BoxData", "[",
  24. RowBox[{"ToBoxes", "[",
  25. RowBox[{RowBox[{"Cases", "[",
  26. RowBox[{RowBox[{"NotebookGet", "[",
  27. RowBox[{"EvaluationNotebook", "[", "]"}], "]"}],
  28. ",", RowBox[{"Cell", "[",
  29. RowBox[{"___", ",",
  30. RowBox[{"CellTags", "\[Rule]", "\"MyGraphic\""}],
  31. ",", "___"}], "]"}], ",", "Infinity"}], "]"}],
  32. ",", "StandardForm"}], "]"}], "]"}], ",",
  33. "\"Output\"", ",",
  34. RowBox[{"CellTags", "\[Rule]", "\"MyCode\""}]}],
  35. "]"}]}], ";"}]}], "Input",
  36. CellChangeTimes -> {{3.5849762872579813`*^9,
  37. 3.584976287259982`*^9}}],
  38. Cell[BoxData[
  39. ButtonBox["\"Print Cell\"", Appearance -> Automatic,
  40. ButtonFunction :>
  41. Cell[BoxData[
  42. ToBoxes[
  43. First[Cases[NotebookGet[EvaluationNotebook[]][[1]],
  44. Cell[___, CellTags -> "MyCode", ___]]]]], "Input",
  45. CellTags -> "MyGraphic"], Evaluator -> Automatic,
  46. Method -> "Preemptive"]], "Print",
  47. CellChangeTimes -> {3.584976288767068`*^9}],
  48. Cell[BoxData[
  49. RowBox[{StyleBox[RowBox[{"First", "::", "first"}],
  50. "MessageName"], RowBox[{":", " "}],
  51. "\"\[NoBreak]\\!\\({}\\)\[NoBreak] has a length of zero \
  52. and no first element. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \
  53. ButtonStyle->\\\"Link\\\", ButtonFrame->None, \
  54. ButtonData:>\\\"paclet:ref/message/First/first\\\", ButtonNote -> \
  55. \\\"First::first\\\"]\\)\""}]], "Message", "MSG",
  56. CellChangeTimes -> {3.584976288780069`*^9}],
  57. Cell[BoxData[
  58. RowBox[{"{",
  59. RowBox[{"Cell", "[",
  60. RowBox[{RowBox[{"BoxData", "[",
  61. RowBox[{"RowBox", "[",
  62. RowBox[{"{",
  63. RowBox[{"\"First\"", ",", "\"[\"", ",",
  64. RowBox[{"RowBox", "[",
  65. RowBox[{"{", RowBox[{"\"{\"", ",", "\"}\""}],
  66. "}"}], "]"}], ",", "\"]\""}], "}"}], "]"}], "]"}],
  67. ",", "\"Input\"", ",",
  68. RowBox[{"CellTags", "\[Rule]", "\"MyGraphic\""}]}],
  69. "]"}], "}"}]], "Output",
  70. CellChangeTimes -> {3.5849762887850695`*^9},
  71. CellTags -> "MyCode"]}, Open]]}, WindowSize -> {707, 525},
  72. WindowMargins -> {{Automatic, 40}, {2, Automatic}},
  73. FrontEndVersion ->
  74. "8.0 for Microsoft Windows (32-bit) (February 23, 2011)",
  75. StyleDefinitions -> "Default.nb"];
  76.  
  77. Cases[nb, Cell[__, CellTags -> "MyGraphic"], Infinity]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement