4
$\begingroup$

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.

$\endgroup$

1 Answer 1

3
$\begingroup$

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.

$\endgroup$

Your Answer

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

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