[Date Index] [Thread Index] [Author Index]
Re: How edit a saved palette?
Murray Eisenberg wrote: > I have a palette somebody else wrote, which I want to edit. So I have > no "source code" notebook for it. I want to edit it, preferably in an > environment that understands Mathematica syntax. > > Obviously, just opening it in Mathematica won't do: it appears as a palette. > > I certainly don't want to edit it in some text editor, for that messes > up the cache and knows nothing about Mathematica syntax. > > And I don't see how to edit it in Wolfram Workbench: If I try to Import > it, no matter whether I specify Initialization cells or Input cells, I > seem to get nothing -- just a message about the nb file from which > (nothing!??) was imported. > > Recommendations? > Hi Murray, First, editing a notebook with a text editor is painful, but the fact that it messes up the cache does not really matter. You will find Mathematica reports this error when you first load the notebook, but if you save it again, the cache corrects itself. I have used this fact many times over the years to achieve various obscure changes. I can certainly see there are problems here, but one way might be to take a copy of your palette notebook, and open it with NotebookOpen. That will give you a Notebookobject that you can use in two possible ways: 1) You could use SetOptions[nbobj,...] to change various options to mimic an ordinary notebook, edit the result, and reverse the changes. Options would certainly include ClickSelect and WindowFrame, and Editable, but probably more. 2) Do a NotebookGet[nbobj], manipulate that structure using Mathematica commands, and save the result with NotebookPut - messy, but it might be good for a one-off application. David Bailey http://www.dbaileyconsultancy.co.uk