By evaluating some Mathematica commands, I wish to get the equivalent effect as selecting Delete All Messages on the message window.


2 Answers 2


You can obtain the NotebookObject corresponding to the messages window using MessagesNotebook, and then delete all the cells using NotebookDelete:

NotebookDelete @ Cells @ MessagesNotebook[]
  • $\begingroup$ Thank you very much indeed ! $\endgroup$
    – MiuraB
    Jul 19, 2019 at 6:21

You can also do what the button in messages notebook does:

    FrontEndToken[FrontEnd`MessagesNotebook[], "SelectAll"], 
    FrontEndToken[FrontEnd`MessagesNotebook[], "Clear"]

The advantage is that it may not require kernel to run at all because all symbols are known by the front end. So this will work:

Button["test", (*our code*), Evaluator -> None ]

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.