如何检测前端令牌是否可以执行?或者,如何检测前端令牌是否无法执行?
示例:如果未选择任何内容,则编辑 -> 复制命令不可用。 FrontEndTokenExecute["Copy"]
在这种情况下只会发出哔哔声,但它没有(程序化)指示它失败了。
如何检测前端令牌是否可以执行?或者,如何检测前端令牌是否无法执行?
示例:如果未选择任何内容,则编辑 -> 复制命令不可用。 FrontEndTokenExecute["Copy"]
在这种情况下只会发出哔哔声,但它没有(程序化)指示它失败了。
我找到了一种方法来处理你的第二个问题,但它并不优雅:
Preferences > Interface > Message and Warning actions
将次要用户界面警告设置为Beep和 Print to Console Notebooks[]
左右)NotebookGet[NotebookObject[FrontEndObject[LinkObject["55d_shm", 1, 1]], 1]]/. Notebook[{___, Cell[a___]}, ___] :> Cell[a]
(当然,您的句柄看起来会有所不同)Cell["You tried to edit a cell that is not editable. You can make the \
cell editable by choosing Cell Editable in the Cell Properties \
submenu.", "Message", "Message", "MSG", PageWidth -> WindowWidth,
ShowCellLabel -> True, CellChangeTimes -> {3.534442831*10^9},
CellTags -> "cantEditLockedCell"]