5
$\begingroup$

At present moment, to batch apply a change in a set of notebook I use a "brute force", rough, method:

(* simple example *)
setBackgroundBlue[notebookFileName_] := Module[
   {tempNb},
   tempNb = NotebookOpen[notebookFileName];
   SetOptions[tempNb, Background -> Blue];
   NotebookSave[tempNb];
   NotebookClose[tempNb];
   ];
SetAttributes[setBackgroundBlue, Listable];

but I bet that there exists a smarter one. Please, can you provide any hint ? I have been brooding about text processing notebooks file, but it's prone to error, especially when dealing with complex structure in TaggingRules..

$\endgroup$
4
  • 2
    $\begingroup$ I'm doing what you are doing. I was thinking about that for a long time and I'm afraid I don't have good news about alternative ways. Another approach could be to use NotebookGet, then it will be easier to deal with a Notebook expression than with pure text. Isn't really different from what you method does and is less handy. Additionaly, you may want to use this method to avoid prompting dynamics Create a notebook and save it without prompting Dynamics. $\endgroup$
    – Kuba
    Apr 28 '16 at 8:10
  • $\begingroup$ Thanks for your reply ! The reason why I'm trying to do that is a long tale and I'm going to post a specific question. By the way, for now, are you aware of any snippet manager particularly fitting Mathematica's code ? $\endgroup$ Apr 28 '16 at 11:52
  • $\begingroup$ I'm not sure I got your question, could you clarify? $\endgroup$
    – Kuba
    Apr 29 '16 at 8:58
  • $\begingroup$ @Kuba There is a plenty of "free snippet manager" in Internet, and I will post a specific question about snippet manager for Mathematica's code, including an hypothetical "wish list". For the present moment I'm simply curious to learn from a seasoned programmer if he have any predilection among them. $\endgroup$ Apr 29 '16 at 20:59

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.