Sometimes I use vscode/ecplise to batch-replace code across multiple notebooks, and the beep becomes quite annoying. Is there a way to disable it? I searched the preference but did not find relevant options.
1 Answer
$\begingroup$
$\endgroup$
There is a workaround. This beep will disappear after opening and saving the notebook. So within Mathematica we can use the following method:
Firstly we use FileNames["*.nb",dir,Infinity]
to get the notebook paths, then feed them into this function for batch-open/save
batchOpenSaveNotebook[nbList_List,pause_:0.5] :=
Module[ {nb,nbobj,counter = 0},
Monitor[
Do[
counter = counter+1;
nbobj = NotebookOpen[nb];
Pause[pause];
NotebookSave[nbobj];
Pause[pause];
NotebookClose[nbobj],
{nb,nbList}
],
ProgressIndicator[counter,{0,Length@nbList}]
]
];
Make sure you have saved other notebooks, since if pause
is too small the frontend may get stuck.