2
$\begingroup$

I have a collection of about 40 notebooks where the options for ParametricPlot and ParametricPlot3D have:

Compiled->False

and I need to switch any/all instances to

Method->{Compiled->False}

Is there a way to do this via Mathematica v.9? One challenge is that I do not know all the notebooks which may or may not have this.

Perhaps Mathematica is not the proper tool and this is more of shell scripting exercise?

Any thoughts on the best way to approach this would be greatly appreciated.

Cheers,

t.

PS - Mac OS X, Mathematica v.9 (latest update)

$\endgroup$

1 Answer 1

2
$\begingroup$

I have no idea how robust this is, but if old.nb is the old notebook,

Export["~/Desktop/new.nb",
 Import["/Users/acl/Desktop/old.nb"] /. 
  RowBox[{"Compiled", "\[Rule]", "False"}] :> 
   RowBox[{"Method", "\[Rule]", 
     RowBox[{"{", RowBox[{"Compiled", "\[Rule]", "False"}], "}"}]}]
 ]

does what you want and saves it to new.nb.

You can go through all notebooks by mapping this over Filenames[] (ask if you don't know how).

$\endgroup$
2
  • $\begingroup$ Thanks for the tip! I'll check the documentation on Filenames[] and I should be able to run with it from here. I wouldn't have noticed the "[Rule]" markup unless you pointed that out. Sometimes it's nice to just use emacs to view the notebooks and see what's actually written! $\endgroup$
    – user7040
    Commented Apr 21, 2013 at 22:04
  • $\begingroup$ @user7040 if you use emacs, why not just use that? do you know elisp? but this may be easier... The idea about FileNames is to do something like SetDirectory[NotebookDirectory[]];FileNames["*.nb"] to obtain a list of notebook files, then maybe assign the code I gave above to a function and map that. Ask here if you have problems. $\endgroup$
    – acl
    Commented Apr 21, 2013 at 22:24

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.