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$ Mar 3 '16 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
    Mar 3 '16 at 16:34
  • 1
    $\begingroup$ nb = EvaluationNotebook[]; SetOptions[EvaluationNotebook[], NotebookAutoSave -> True]; Options[nb, NotebookAutoSave] Returns True $\endgroup$ Mar 3 '16 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$ Mar 3 '16 at 16:51
  • 1
    $\begingroup$ @Kagaratsch Oh! I asked about that some time ago mathematica.stackexchange.com/q/8761/193 $\endgroup$ Mar 4 '16 at 1:07
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$ Mar 3 '16 at 18:45
  • $\begingroup$ and your computer should be turned on .) $\endgroup$ Mar 3 '16 at 18:47
  • 1
    $\begingroup$ and, if based in Argentine, make sure to set-up an emergency power unit. $\endgroup$ Mar 3 '16 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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