Copy link to clipboard
Copied
Hi,
I am using the below code to export preflight report. It was working fine but now i am getting some error in the line aggregatedResults . I could not get why its happening?
Code:
var preflightProfile = app.preflightProfiles.item(preflightName);
var preflightProcess = app.preflightProcesses.add(myDoc, preflightProfile);
var waitProcess = preflightProcess.waitForProcess();
var result = preflightProcess.processResults;
alert("result" + result + "\n" + myDoc.name)
if (result != 'None')
{
var errors = preflightProcess.aggregatedResults[2];
//alert("Preflight : " + preflightProcess.aggregatedResults[2].length + " error(s) " + "\n" + myDoc.name);
if(errors.length > 0) // Errors count
{
var txtFilePath = myDoc.filePath.fsName + "/" + myDoc.name;
preflightProcess.saveReport(File(txtFilePath.replace(".indd",".txt")));
preflightProcess.remove();
}
}
I don't know the reason.. why its throwing the error... Sometimes its not throwing any error...
Copy link to clipboard
Copied
Hard to tell right away. Set a breakpoint before accessing the property and see what "aggregatedResults" actually is.
…
$.bp();
var errors = preflightProcess.aggregatedResults[2];
…
The code should stop and the data browser should let you know inspect current objects state.
HTH
Loic
Copy link to clipboard
Copied
Hi,
Thank you...
I debug and checked in ExtendScript Toolkit but i did not do in an InDesign Applicaiton.
I will check how to do in InDesign Application.
Copy link to clipboard
Copied
You actually need to target InDesign as application. Once that done, you will be all set to debug.
Copy link to clipboard
Copied
I debug the code... its show clear runtime error in "Extendscript Toolkit" in the line "var errors = preflightProcess.aggregatedResults[2];"...
Dont know how to rectify the error...
if i run the below code for an active document its working.. but when i run it for batch process its throwing the error.
I could not get the reason where i did mistake and what is the issue...
Code:
preflightName = "FileValidate";
preflightReport()
alert("Exit");
exit()
function preflightReport()
{
alert("preflightReport")
var errCnt = 0;
myDoc = app.activeDocument;
var workingPreProfile = app.activeDocument.preflightOptions.preflightWorkingProfile;
var preflightProfile = app.preflightProfiles.item(preflightName);
alert("preflightProfile" +preflightProfile.name)
if(preflightProfile.isValid)
{
var preflightProcess = app.preflightProcesses.add(app.activeDocument, preflightProfile);
var waitProcess = preflightProcess.waitForProcess();
var result = preflightProcess.aggregatedResults[2];
alert("NAME : " + myDoc.name + "\n " + result)
if(result.length > 0)
{
var txtFilePath = myDoc.filePath.fsName + "/" + myDoc.name;
preflightProcess.saveReport(File(txtFilePath.replace(".indd",".txt")));
preflightProcess.remove();
}
}
}
Can anyone tell me how to resolve this issue??
Copy link to clipboard
Copied
Hi,
When i run the script i am getting this result.
"No error yet; still looking"..