Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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).

share|improve this answer
    
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! –  user7040 Apr 21 '13 at 22:04
    
@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. –  acl Apr 21 '13 at 22:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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