# How to open and explore the codes of the system Palettes files

The built in Palettes of Mathematica are simply .nb files which can be found in the following place:

SystemOpen@FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "Palettes"}]  I was trying to open anyone of them but it turned out these files opened directly into the Palettes form. I tried to open them in the Notepad but (as normal) they opened in the expression form. I tried to copy the Notepad content into expression cell and convert the cell into display from but it did not work and some errors were generated. Any idea how to open these files in the normal way so that I can explore the codes of these files? • There is no difference between a palette and a standalone cdf, what was evaluated is lost and what you have needs to be be converted from boxes to expressions. Here is and old topic about that (probably needs updates): How can I recover the source code from cdf file? – Kuba Jun 6 '16 at 5:42 • Have you tried selecting Generate Notebook from Palette from the Palettes menu and then converting the generated cell into input form? That works for me. – m_goldberg Jun 6 '16 at 5:47 • @m_goldberg In version 10.4.1 I don't have the Generate Notebook from Palette item in the Palettes menu but I do have it in versions 10.0.1 and 8.0.4. With version 8.0.4 your idea seems to work well. It is surprising that in the latest version they removed it... :( – Alexey Popkov Jun 6 '16 at 13:01 • @AlexeyPopkov. I'm using 10.4.1 and I the item is on my Palettes menu. I'm running on OS X. It is only available when there is a palette loaded. Did you have a palette on your screen? – m_goldberg Jun 6 '16 at 15:18 • @Mr.Wizard Thanks for the link, the workaround suggested by Kuba is very nice! Undoubtedly it is the same issue but now (version 10.4.1) the Generate Notebook from Palette menu item is absent at all. – Alexey Popkov Jun 7 '16 at 10:00 ## 2 Answers You can Get the palette, then apply MakeExpression in order to convert boxes into the corresponding high-level expression, and then display the result as InputForm. For example: palette = Get@ FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd",
"Palettes", "SlideShow.nb"}];
InputForm @@ MakeExpression[palette, StandardForm]


If you aren't satisfied with the default formatting produced by InputForm, I recommend reading this answer of mine.

Actually I think you can use NotebookGet to get the code of the palettes. With only your notebook and palette opened, Using NotebookGet@Notebooks[][[2]] can get you the expression form, if that's what you need.

But the problem is that this result, just like other outputs of NotebookGet, is full of Cell or CellBox or so, actually still hard to read. But the essential information (especially formats of grids)lies inside them so they're necessary.

Maybe I can give you more detailed and targeted solution to this problem if you can provide me a more specific desired output form.