diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index cebec85c5..7f2e6e1eb 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -15,6 +15,7 @@ processing. See also MacrosWindow and ApplyMacroDialog. *//*******************************************************************/ +#define wxLOG_COMPONENT "MacroCommands" #include "Audacity.h" // for USE_* macros #include "BatchCommands.h" @@ -734,9 +735,17 @@ bool MacroCommands::ApplyMacro( mAbort = false; + // Is tracing enabled? bool trace; gPrefs->Read(wxT("/EnableMacroTracing"), &trace, false); + // If so, then block most other messages while running the macro + wxLogLevel prevLevel = wxLog::GetComponentLevel(""); + if (trace) { + wxLog::SetComponentLevel("", wxLOG_FatalError); + wxLog::SetComponentLevel(wxLOG_COMPONENT, wxLOG_Info); + } + size_t i = 0; for (; i < mCommandMacro.size(); i++) { const auto &command = mCommandMacro[i]; @@ -768,6 +777,11 @@ bool MacroCommands::ApplyMacro( break; } + // Restore message level + if (trace) { + wxLog::SetComponentLevel("", prevLevel); + } + res = (i == mCommandMacro.size()); if (!res) return false;