Notebooks that auto-execute when opened? -- SOLVED (I think)
- To: mathgroup at smc.vnet.net
- Subject: [mg97377] Notebooks that auto-execute when opened? -- SOLVED (I think)
- From: AES <siegman at stanford.edu>
- Date: Thu, 12 Mar 2009 02:17:45 -0500 (EST)
- Organization: Stanford University
In an earlier message I asked: > Possible to set an option for a notebook such that it automatically > executes when opened, that is, when the nb icon is dbl-clicked > or the file is otherwise opened in the OS being used? and mike.honeychurch at gmail.com very helpfully replied (lightly edited): Yes -- for example, make a notebook like SetOptions[EvaluationNotebook[], InitializationCellWarning -> False, InitializationCellEvaluation -> True] Plot[ {x,x^2,x^3}, {x,0,1}, PlotStyle->Thick] Then make all these cells initialization cells and the notebook will evaluate when you open it. Mike So I tried this, and it worked exactly as I desired -- except that despite the "InitializationCellWarning->False" entry in the above, this notebook insisted on making me respond to a warning dialog before it executed. So, I looked at the Help message for this option, and got (again, lightly edited for brevity): InitializationCellWarning is an option for notebooks that specifies whether a warning should be given when a notebook containing initialization cells is opened. ** This function has not been fully integrated into the long-term Mathematica system, and is subject to change. ** With the default setting InitializationCellWarning->True, a warning in the form of a dialog box is given, asking the user to choose whether the initialization cells should be automatically evaluated. In order for the warning not to occur, this option must be set to False both in the notebook being opened _and at the global level_. [my emphasis]. This is a security feature to prevent a notebook from silently evaluating cells without the user¹s knowledge, unless the user has specifically enabled this by setting the option to False at the global level. So, I went to Format >> Option Inspector >> Global >> Alphabetical and discovered that this option was indeed there, and could be unclicked -- after which the "Execute when opened" function I wanted seems to work exactly as desired (desired by me, anyway). So, thanks again to Mike.