Wolfram mathematica 退出Mathematica 5和7内核的快捷键?

Wolfram mathematica 退出Mathematica 5和7内核的快捷键?,wolfram-mathematica,Wolfram Mathematica,说明如何通过修改文件KeyEventTranslations.tr,定义自定义键盘快捷键以退出所选笔记本的内核。默认情况下,Mathematica 5.2的此文件位于文件夹中的Windows下 C:\Program Files\Wolfram Research\Mathematica\5.2\SystemFiles\FrontEnd\TextResources\Windows C:\Program Files\Wolfram Research\Mathematica\7.0\SystemFil

说明如何通过修改文件
KeyEventTranslations.tr
,定义自定义键盘快捷键以退出所选笔记本的内核。默认情况下,Mathematica 5.2的此文件位于文件夹中的Windows下

C:\Program Files\Wolfram Research\Mathematica\5.2\SystemFiles\FrontEnd\TextResources\Windows
C:\Program Files\Wolfram Research\Mathematica\7.0\SystemFiles\FrontEnd\TextResources\Windows
文件夹中的Mathematica 7.0.1

C:\Program Files\Wolfram Research\Mathematica\5.2\SystemFiles\FrontEnd\TextResources\Windows
C:\Program Files\Wolfram Research\Mathematica\7.0\SystemFiles\FrontEnd\TextResources\Windows
EventTranslations[{
之后的这个文件中,我添加了一行:

Item[KeyEvent["q", Modifiers -> {Control}],FrontEndExecute[FrontEndToken[SelectedNotebook[],"EvaluatorQuit",Automatic]]]
但不幸的是,重新启动Mathematica后,快捷方式
Control+q
在两个版本上都不起作用

此外,在Mathematica 7.0.1中,执行命令

FrontEndExecute[FrontEndToken[SelectedNotebook[], "EvaluatorQuit", Automatic]]
按“退出”会导致应用程序出错,并关闭
FrontEnd
,同时丢失所有未保存的更改(我使用的是Windows 2000)

我做错了什么

编辑:问题在于添加了
项[…]
(感谢belisarius)。下面是添加到
KeyEventTranslations的正确行。tr

Item[KeyEvent["q", Modifiers -> {Control}],FrontEndExecute[FrontEndToken[SelectedNotebook[],"EvaluatorQuit",Automatic]]],
现在,快捷方式
Control+q
在Mathematica 5.2和7.0.1中都运行良好。 但上面带有“应用程序错误”的错误仍然出现(不是在使用快捷方式时,而是仅在笔记本中评估
FrontEndExecute[FrontEndToken[SelectedNotebook[],“EvaluatorQuit”,Automatic]
时出现)。

相关注释可能会对您有所帮助

顺便说一句…我在v7中也做了同样的事情,它成功了。你在哪个版本上遇到了问题


请注意:请非常小心语法验证每一项[Keyevent]都以逗号结尾,但最后一项除外。

我的帖子中链接了答案。问题在于5.2和7.0.1版本,但v.7.0.1版本更深(请参阅我帖子中的最后一段).@Alexey抱歉,我没有看到链接。@Alexey只是一个提示:请非常小心语法,验证每个项目[Keyevent以逗号结尾,除了最后一个。谢谢你关于语法的注释!我忘记了逗号。那是我的错误。现在
Control+q
在Mathematica 5.2和7.0.1中都能很好地工作。再次感谢你!另一个问题:有没有办法避免“退出内核”对话框,并在按下
Ctrl+q
后立即退出内核?