2
$\begingroup$

I want a notebook to automatically save after any cell is evaluated. I found that I should use the command

SetOptions[XXX, NotebookAutoSave -> True]

to do that, where XXX should be referring to the current notebook. Unfortunately, I have been searching the web for half an hour now and was not able to find the command which refers to "this notebook". I tried $FrontEndSession, $FrontEnd and even $Notebooks and nothing helped. Therefore, my question is:

What refers to "this notebook" within the SetOptions command?

$\endgroup$
11
  • 1
    $\begingroup$ EvaluationNotebook[ ]? $\endgroup$ Commented Mar 3, 2016 at 16:32
  • $\begingroup$ @Dr.belisarius If I exectue SetOptions[EvaluationNotebook[], NotebookAutoSave -> True], write a new cell afterwards and exectue it, the file stays unsaved. $\endgroup$
    – Kagaratsch
    Commented Mar 3, 2016 at 16:34
  • 1
    $\begingroup$ nb = EvaluationNotebook[]; SetOptions[EvaluationNotebook[], NotebookAutoSave -> True]; Options[nb, NotebookAutoSave] Returns True $\endgroup$ Commented Mar 3, 2016 at 16:39
  • 2
    $\begingroup$ That is exactly by design: NotebookAutoSave is a notebook option which specifies whether the notebook should automatically be saved after each piece of output generated by evaluation in it. $\endgroup$ Commented Mar 3, 2016 at 16:51
  • 1
    $\begingroup$ @Kagaratsch Oh! I asked about that some time ago mathematica.stackexchange.com/q/8761/193 $\endgroup$ Commented Mar 4, 2016 at 1:07

1 Answer 1

3
$\begingroup$
nb = EvaluationNotebook[]; 
SetOptions[EvaluationNotebook[], NotebookAutoSave -> True]; 
Options[nb, NotebookAutoSave]

(* True *)
$\endgroup$
3
  • 2
    $\begingroup$ Note that the notebook should have a name, i.e., it should have been saved before. $\endgroup$ Commented Mar 3, 2016 at 18:45
  • $\begingroup$ and your computer should be turned on .) $\endgroup$ Commented Mar 3, 2016 at 18:47
  • 1
    $\begingroup$ and, if based in Argentine, make sure to set-up an emergency power unit. $\endgroup$ Commented Mar 3, 2016 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.