# Is there a way to programmatically set global preferences?

Can I set global preferences that are accessible via "Edit"->"Preferences" programmatically from within a notebook?

As learned from this question, turning off anti-aliasing can make a huge difference in the maximum allowable ImageSize. This can be done via menu:

The slider is setting the value of HardwareAntialiasingQuality that can be found with the option inspector:

Question: Is there a way to set/reset the value of HardwareAntialiasing (and others) programmatically? I´d like to set this with a line only in those notebooks that benefit from this setting and have proper antialiasing for the rest.

Footnote: this answer does help with setting the rendering method directly within a Graphics3D expression, and as @Sjoerd's answer shows this also works in more global way.

-
I'm also curious about how to set it back to the default value programatically (what that little green X does in your screenshot). –  Szabolcs Feb 11 '13 at 18:52

I believe the following should work:

SetOptions[$FrontEnd, RenderingOptions -> {"HardwareAntialiasingQuality" -> 1}]  for a permanent global setting, SetOptions[$FrontEndSession, RenderingOptions -> {"HardwareAntialiasingQuality" -> 1}]


for a temporary (session duration) global setting, and

SetOptions[EvaluationNotebook[], RenderingOptions -> {"HardwareAntialiasingQuality" -> 1}]


in each notebook for which you want an individualized setting.

-
Spot on! Works nicely - and for the other options as well. I am looking forward to any answers topping that :-) –  Yves Klett Feb 11 '13 at 18:39
@YvesKlett Glad to be of service. –  Sjoerd C. de Vries Feb 11 '13 at 18:44
Maybe it's good to note that CurrentValue works as well. It is advantageous to use CurrentValue when there are sub options to an option (like a -> {b -> 1, c -> 2}) because it makes it easy to set one sub option without touching the rest. –  Szabolcs Feb 11 '13 at 18:53
Perhaps you can also mention $FrontEndSession for completeness... – The Toad Feb 11 '13 at 19:14 @SjoerdC.deVries You might even mention the mythical$DefaulFrontEnd, taught to us by Director Futz here –  Rolf Mertig Feb 11 '13 at 22:38

Instead of SetOptions, it is also possible to use CurrentValue. In this particular case the syntax is

CurrentValue[$FrontEnd, {RenderingOptions, "HardwareAntialiasingQuality"}] = 1.0  CurrentValue is easier to use than SetOptions in the situation when a single option has multiple sub options. If we have an option of the form opt -> {a -> 1, b -> 2}, then SetOptions[..., opt -> {a -> 1}] would remove the sub-option b. (This is not the case with RenderingOptions, but it is with others, e.g. "PalettesMenuSettings" or TaggingRules, which can have completely arbitrary sub options.) The simplest solution in this situation is CurrentValue[object, {opt, a}] = .... This will not touch the suboption b. - @Scabolcs +1 Also: sometimes SetOptions just does not work. E.g. SetOptions[Cell,CellEpilog->somefun] gives a strange message, while CurrentValue is acting just fine. – Rolf Mertig Feb 11 '13 at 22:40 But note what John Fultz has to say about problems with CurrentValue and $DefaultFrontEnd here. –  Sjoerd C. de Vries Feb 11 '13 at 22:58
@Sjoerd Thanks for pointing that out, I didn't know. –  Szabolcs Feb 11 '13 at 23:11