Direct answer
Use a severity-aware wrapper function instead of calling alert() directly. Route critical conditions to a modal alert, and route warning and info conditions to the Info panel plus an append-only log file. Script-driven alert() is independent of After Effects' "Show Warning Dialogs" preference, so toggling that preference will not suppress your custom notifications.
Likely explanation versus established behavior
Likely explanation: Your audit script calls alert() for every failed condition. Because alert() is modal, the UI thread stops until the user dismisses it, which becomes disruptive during iterative project traversals or render checks.
Established behavior: ExtendScript has no built-in severity API or per-script alert preference. $.writeln() writes to the Info panel without blocking. A File object opened in append mode ("a") persists lines after the script ends. The global warning preference suppresses native After Effects warnings, not alert() invoked from your JSX.
Steps for this case
- Add a
notify(severity, message) function to your JSX. Prepend an ISO timestamp so Info panel entries remain traceable.
- Branch on severity:
critical calls alert(); warning and info call $.writeln() and append to Folder.temp + "/ae_audit.log".
- Wrap file I/O in
try/catch so a locked or unreachable log file does not abort the audit.
- Replace direct
alert() calls in your audit conditions with notify().
function notify(severity, message) {
var stamp = "[" + new Date().toISOString() + "]";
var line = "[" + severity.toUpperCase() + "] " + stamp + " " + message;
if (severity === "critical") {
alert(line);
} else {
$.writeln(line);
try {
var logFile = new File(Folder.temp + "/ae_audit.log");
if (logFile.open("a")) {
logFile.writeln(line);
logFile.close();
}
} catch (err) {
// Non-critical channel failure must not halt the audit.
}
}
}
// Example audit usage
if (missingFootage) {
notify("critical", "Missing footage in item " + item.id);
} else if (unusedEffect) {
notify("warning", "Unused effect detected on " + layer.name);
}
Verification
- Save the JSX and run it from File > Scripts > Run Script File in After Effects CC 2022–2024.
- Confirm
notify("critical", ...) shows a modal dialog, while notify("warning", ...) appears only in Window > Info and in the temp log file.
- Disable Preferences > General > Show Warning Dialogs and rerun; your custom
alert() should still appear.
- Restart After Effects and confirm
ae_audit.log still exists in the system temp folder.
Assumptions: You are running standalone ExtendScript (JSX), not a CEP panel, and Folder.temp is writable on the host. If the script runs through app.scheduleTask or a render-queue callback, keep non-critical messages off alert() because modal dialogs can stall the host UI.
Review note: If your audit emits hundreds of messages per second, writing to disk on every call may add measurable UI lag. Batch messages in memory and write once at the end, or throttle to one write per interval.