3
$\begingroup$

In Mathematica 11.0 I want to temporarily change the behavior of error messages via code.

user interface log messages option in settings menu

I tried the following code:

(* Disable warnings, but "Ignore" is not a valid value *)
SetOptions[$FrontEnd, MessageOptions -> {"ConsoleMessageAction" -> "Ignore"}]
(* do some stuff... *)
(* re-enable warnings, "PrintToConsole" is a valid value *)
SetOptions[$FrontEnd, MessageOptions -> {"ConsoleMessageAction" -> "PrintToConsole"}]

Re-enabling works, but I can't turn the warnings off. The first command gives the error message

The specified setting for the option MessageOptions, ConsoleMessageAction cannot be used.

How can I find out the proper value for "ConsoleMessageAction" for setting it to Ignore?

$\endgroup$
3
$\begingroup$

You can observe what changes when you set it to Ignore:

Dynamic @ CurrentValue[
   $FrontEnd, {MessageOptions, "ConsoleMessageAction"}
]

And you will see that the corresponding value is an empty list: {};

Another way would be to parse the content of the Preferences.nb dialog but that wasn't necessary here.

$\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.