0
$\begingroup$

I finally have my autoSave[] function that appears to work. Although it does automatically save file the DateString (dynamic in-place updating) which provides the interval time to do an autoSave does not appear to be consistent. Is this because the frontend will not save file if no edits had taken place since last save? How would you improve autoSave[]? But I know it works by making changes to a test file and closing without saving has all edits contained when reopened.

autoSave[minutes_ : 10] := 
  Row[{"last autoSave", 
    Dynamic[Refresh[NotebookSave[]; DateString[], 
      UpdateInterval -> minutes 60]]}, " \[Rule] "];
$\endgroup$
6
  • $\begingroup$ Where's that placed? Because Dynamic does not fire unless visible on the screen. related: 13997 $\endgroup$ – Kuba Jun 25 '20 at 5:19
  • $\begingroup$ @Kuba placed in a cell inside an open notebook. it only displays a dynamic evaluated DateString[] in an output cell. $\endgroup$ – Jules Manson Jun 25 '20 at 8:57
  • $\begingroup$ If the cell scrolls away from the screen it stops working. See tutorial/IntroductionToDynamic $\endgroup$ – Kuba Jun 25 '20 at 9:00
  • 1
    $\begingroup$ Try placing it in a docked cell so it is always visible. $\endgroup$ – Rohit Namjoshi Jun 25 '20 at 15:32
  • $\begingroup$ @RohitNamjoshi great idea. i tried doing that but the official documentation only confused me. if you feel like it write out steps in an answer and if it works ill tag your answer as accepted and press the up key giving you credit. $\endgroup$ – Jules Manson Jun 26 '20 at 4:24

Your Answer

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

Browse other questions tagged or ask your own question.