3
$\begingroup$

I have a nb file that I have been editing frequently in M 10, but no matter how many times I modify the file or edit the file in M 10 it doesn't seem to update its cache.

Everytime I open the file I receive the following message.

The file you are opening appears to have been edited outside of the Wolfram System. The file outline cache was ignored. This should not affect any of the contents of the file.

How can I create function such that I can eliminate such a message?

Currently I have tried running the following function.

CleanNotebook[nb_NotebookObject] := 
 Module[{}, 
  SetOptions[nb, 
   PrivateNotebookOptions -> {"FileOutlineCache" -> False}, 
   "TrackCellChangeTimes" -> False];
  SetSelectedNotebook[nb];
  SelectionMove[nb, All, Notebook];
  FrontEndExecute[{FrontEnd`RemoveOptions[FrontEnd`SelectionObject, 
     "CellChangeTimes"]}]
  ]
$\endgroup$
  • $\begingroup$ I get these messages from time to time but I suspect some OS/file-system issues with cached files (Windows sync)... usually they disappear after a while. Have you tried saving under a different filename? $\endgroup$ – Yves Klett Oct 2 '14 at 15:40
  • $\begingroup$ @YvesKlett This seems to work file = FileNameJoin[{"C:\\Users\\a\\Desktop","file.nb"}];nb = NotebookOpen[file];NotebookSave[nb, file];NotebookClose[nb]; but it results in tons of popups if you loop it over some files. $\endgroup$ – William Oct 2 '14 at 17:50
4
$\begingroup$

Performing a couple tests it appears to be a notebook option that is causing the issue. Wiping all notebook options seems to fix the issue along with calling the function above. I will post an update if I can determine any more information.

deleteCache[x_String] := Module[{nb, nb2},
  nb = NotebookOpen[x];
  nb2 = CreateDocument[NotebookGet[nb][[1]]]; 
  NotebookClose[nb];
  DeleteFile[x];
  NotebookSave[nb2, FileNameJoin[{$TemporaryDirectory, "t.nb"}]];
      CopyFile[FileNameJoin[{$TemporaryDirectory, "t.nb"}], x];
  ]
$\endgroup$

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.