4

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.
kjo
  • 11,717
  • 1
  • 30
  • 89

1 Answers1

2

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.

Ray Shadow
  • 7,816
  • 1
  • 16
  • 44