MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Clearing when closing notebooks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38814] Re: Clearing when closing notebooks
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Tue, 14 Jan 2003 06:11:16 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Recall Mike wanted to automatically reset some things when a notebook is
closed.  I am pretty sure that isn't possible without making a custom Front
End (people can and have made custom front ends, but it's a big job).

You might find the following a nice alternative.  Copy the code below into a
notebook and click  "Yes"  to interpret the notebook expression.  You will
then have a button that, when clicked, effectively does the following:
   (1)  Clear all variables in the Global context.
   (2)  Reset  $DisplayFunction.
   (3)  Reset  $Line to 1.
Then it's a simple task to click the button whenever you want.  Actually
resetting  $Line  happens a bit later than I would expect, and I can't
figure out how to "fix"  that.  Anyway you might find it useful.  

The first time I close the notebook with the Palette/Button I am asked if I
want to save it.  Then I save it in folder 
   C:\Program Files\Wolfram
Research\Mathematica\4.1\SystemFiles\FrontEnd\Palettes  
That way I can open the Button/Palette via menu selection (File | Palettes).
You will have a similar folder for your palettes.


Regards,
  Ted Ersek

Download my collection of Mathematica tricks from:  
http://www.verbeia.com/mathematica/tips/Tricks.html
and  
http://www.verbeia.com/mathematica/tips/GraphicsTricks.html


(*-----------------------------*)

Notebook[{
Cell[BoxData[
    ButtonBox[\(Start\ Over\),
      ButtonFunction:>(CompoundExpression[ 
          ClearAll[ "Global`*"], 
          Set[ $DisplayFunction, 
            Function[ a, 
              Display[ $Display, a]]], 
          Set[ $Line, 0]]&),
      ButtonEvaluator->Automatic,
      Active->True]], NotebookDefault,
  CellFrame->True,
  CellMargins->{{Inherited, Inherited}, {0, Inherited}},
  Evaluatable->True,  
  LineSpacing->{1.25, 0},
  FontFamily->"Courier",
  FontWeight->"Bold",
  Background->RGBColor[1, 0.975998, 0.949996]]
},
ScreenRectangle->{{0, 1280}, {0, 936}},
ClosingAutoSave->False,
Editable->False,
WindowToolbars->{},
WindowSize->{Fit, Fit},
WindowMargins->{{Automatic, 59}, {Automatic, 30}},
WindowFrame->"Palette",
WindowElements->{},
WindowFrameElements->"CloseBox",
WindowClickSelect->False,
ShowCellBracket->False,
CellMargins->{{0, 0}, {Inherited, 0}},
Active->True,
CellOpen->True,
ShowCellLabel->False,
ShowCellTags->False,
Magnification->1.25
]



  • Prev by Date: Re: successive over relaxation
  • Next by Date: RE: Position of tick labels in 2D plots
  • Previous by thread: Re: Clearing when closing notebooks
  • Next by thread: Symbolic Calculation