Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use Get to load some pretty substantial packages from a custom menu in the Mathematica toolbar (added via
The problem is, the standard 5-second evaluation timeout seems to apply to commands executed with KernelExecute, so only a fraction of my Get is evaluated before the command times out.

I'm wondering whether there's an option that can be passed to KernelExecute (or to Item / MenuItem) that will remove that time constraint so that my command can be executed completely.

share|improve this question
up vote 7 down vote accepted

As of version 9, MenuItem now takes the Method option, similarly to Dynamic and Button. Which means that you can make it a "Queued" evaluation. To demonstrate:

  "Open", {MenuItem["Delayed New", 
    System`KernelExecute[Pause[10]; NotebookCreate[]], 
    System`MenuEvaluator -> Automatic]}]]

Here we have a command which adds a new menu item after the "Open" menu item which waits 10 seconds, then opens a notebook. And it fails. Similar to what you're seeing. So, let's reset the menus:


and add it again, but this time with the Method option:

  "Open", {MenuItem["Delayed New", 
    System`KernelExecute[Pause[10]; NotebookCreate[]], 
    System`MenuEvaluator -> Automatic, Method -> "Queued"]}]]

This has all the same features and limitations of the "Queued" usage elsewhere. For example, if you have a bunch of Shift+Enter evaluations in your queue, this goes to the back of the line and waits for those.

share|improve this answer
Fantastic! This allows my menu to function precisely as intended. It's also worth noting that Method->"Queued" also seems to allow kernel-blocking dialogs such as InputDialog to run from within MenuItem without hanging the frontend. – bdot Nov 2 '13 at 20:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.