Looking to silence alerts while processing files
Hey y'all,
I'd like to start by acknowledging that using ExtendScript for data collection might not be ideal, but it's currently my only option. My task is to gather metadata labeled "Plates" from Adobe files. Previously, the process involved manually copying and pasting details from over 50,000 files. Thankfully, I've managed to reduce this to a 22-hour task using the script below. However, I'm encountering an issue while the script runs. An unrelated error message keeps popping up during the script's execution, requiring manual confirmation by clicking 'OK' each time. As a temporary workaround, we've resorted to keeping the Enter key pressed down, but obviously, we're looking for a more efficient solution for our next round of data collection.
Does anyone have any suggestions? I was exploring the possibility of using 'app.preferences.setBooleanPreference' to bypass this, but haven't found a way to make it effective. Any advice would be greatly appreciated.

// Main function to control the flow of operations
function main() {
processFilesInFolder('D:/files','~/Downloads/Plates Metadata.txt','.pdf');
}
// Function to extract and save plate names from the document's XMP metadata
function extractAndSavePlateNames(logLoc) {
try {
if (app.documents.length === 0) {
throw new Error("No document open");
}
var doc = app.activeDocument;
var xmpString = doc.XMPString;
var xmpXML = new XML(xmpString);
var plateNamesXML = xmpXML..*::PlateNames.*::Seq.*::li;
if (plateNamesXML.length() === 0) {
throw new Error("No plate names found in the document's XMP metadata.");
}
var excludePlates = {"Cyan": true, "Magenta": true, "Yellow": true, "Black": true};
var plateNames = [];
for each (var plateName in plateNamesXML) {
var name = plateName.text().toString();
if (!excludePlates[name]) {
plateNames.push(name);
}
}
var file = new File(logLoc);
file.open(file.exists ? "a" : "w");
file.write(plateNames.join("\n"));
file.write("\n");
file.close();
} catch (e) {
alert("Error in extractAndSavePlateNames function: " + e.message);
}
}
// Function to process each file in the specified folder
function processFilesInFolder(fileLoc, logLoc, filetype) {
try {
var folderPath = fileLoc;
var folder = new Folder(folderPath);
if (!folder) {
throw new Error("No folder selected");
}
var files = folder.getFiles("*" + filetype);
for (var i = 0; i < files.length; i++) {
var file = files[i];
if (file instanceof File) {
var doc = app.open(file);
extractAndSavePlateNames(logLoc);
doc.close(SaveOptions.DONOTSAVECHANGES);
}
}
alert("Done!","Keaton wuz here");
} catch (e) {
alert("Error in processFilesInFolder function: " + e.message);
}
}
// Run the main function
main();
