4
$\begingroup$

NB: None of the responses to Programmatically quitting the FrontEnd or running without one? answers the question asked here.


If one runs FrontEndTokenExecute["FrontEndQuit"], Mathematica pops up a dialog about a "running evaluation", etc. This behavior pauses the program's execution indefinitely, which rules out this approach for terminating the front end programmatically.

Is there a way around this?

Acceptable strategies include:

  1. suppressing the dialog altogether;
  2. clicking on its OK button programmatically (though I suspect this may be impossible to do from within the front end session itself);
  3. using some way other than FrontEndTokenExecute["FrontEndQuit"] to programmatically terminate the front end.
$\endgroup$
2

1 Answer 1

2
$\begingroup$

One way to avoid "running evaluation" dialog is to schedule the shutdown using RunScheduledTask:

RunScheduledTask[FrontEndTokenExecute["FrontEndQuit"], 1];

Note that you still have to save all notebooks first, otherwise you will get a "save" dialog.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks! It works even with a 0-second "delay". $\endgroup$
    – kjo
    Jun 30, 2017 at 17:47

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.