Which commands can you put in KeyEventTranslations.tr ? There is an extensive list of FrontEndTokens, but what else can you use? Why something like this doesn't work:

Item[KeyEvent["r", Modifiers -> {Command}],
    FrontEndToken[SelectedNotebook[], "EvaluatorStart", "Local"]

With FrontEnd``KernelExecute` one could put any command there, but what's the trick?

Edit (some more observations)

This does work in MenuSetup.tr, like explained here (and of course in the current session). Menu items can be executed by a Kernel or FrontEnd. However, for each item there can be only one MenuEvaluator, so after quitting Kernel the rest of commands will not be executed.

Also, for some reason, KernelExecute, when started from Menu or a button (not from a Cell), is not only queued to Kernel, but has priority!

  • $\begingroup$ You can also use the EvaluatorQuit token. mathematica.stackexchange.com/questions/6224/… $\endgroup$
    – Szabolcs
    Mar 13, 2013 at 2:50
  • $\begingroup$ @Szabolcs No, actually I reached here because I wanted to make Restart Kernel shortcut. And EvaluatorQuit token pops up a dialog window. However, quitting kernel may just be enough as it will start automatically on next command. Nevertheless, my question stays- why can't you put explicit commands (for kernel execution) in KeyEventTranslations.tr? What else can one put there besides FrontEnd tokens? $\endgroup$
    – Vladimir
    Mar 13, 2013 at 11:58
  • 3
    $\begingroup$ But KernelExecute works. Look here $\endgroup$ Mar 14, 2013 at 11:09
  • $\begingroup$ @RolfMertig That is really a relief! Perhaps for KernelExecute is necessary to include MenuEvaluator? But it doesn't make sense, it's not MenuItem, either. And so when you create file in $UserBaseDirectory Mathematica will load it preferably to the original one in $InstallationDirectory ? $\endgroup$
    – Vladimir
    Mar 14, 2013 at 11:44
  • $\begingroup$ Or perhaps because I called it as FrontEndExecute[KernelExecute[...]] :D $\endgroup$
    – Vladimir
    Mar 14, 2013 at 12:52


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.