Palette to write out Global Names to a Selected NB
- To: mathgroup at smc.vnet.net
- Subject: [mg78886] Palette to write out Global Names to a Selected NB
- From: Donald DuBois <donabc at comcast.net>
- Date: Thu, 12 Jul 2007 05:13:05 -0400 (EDT)
Hello, I am trying to create a Palette with a button which, when clicked, will write out the Global names (i.e. Names["Global`*"] ) to the notebook which is currently selected. The following code works and puts out a linear list of the global names: CreatePalette[ { Button["Glbl Names", With[{nb = InputNotebook[]}, SelectionMove[nb, After, Notebook]; NotebookWrite[nb, Cell["Names[\"Global`*\"]"]]; SelectionMove[nb, All, CellContents]; SelectionEvaluate[nb] ] ] } ] The above code produces correctly, in the selected notebook, the list: {"a52", "a53", "data1", "m1", "m2", "m3", "nb", "nb$", "var1", "var2"} However, when I try to use Grid in order to format the linear list of names for readability, (useful if there are many names) I can't get the Grid function to work: CreatePalette[ { Button["Glbl Names", With[{nb = InputNotebook[]}, SelectionMove[nb, After, Notebook]; NotebookWrite[nb, Cell["Grid[Partition[Names[\"Global`*\"],3,3,1,\" \"]]"]]; SelectionMove[nb, All, CellContents]; SelectionEvaluate[nb] ] ] } ] This code produces in the selected notebook: Grid[{{"a52", "a53", "data1"}, {"m1", "m2", "m3"}, {"nb", "nb$", "var1"}, {"var2", " ", " "}}] Any help to get Grid to work would be greatly appreciated. Thank you. Don