Posted this in the main Adobe forum, but no luck there so far. Was hoping someone here might be able to help me out with a problem I’m having. I am iterating through a file array and placing PDFs on new pages, and some of the files are password protected. If the user doesn’t know the password, I’d like them to be able to cancel and skip to the next file. Does anyone know how to access this part of the file through ExtendScript or a try/catch to solve for it? I have a try/catch on the frame.place() function, but that didn’t work. Below is a snippet. I am getting the following error message in debugger: (#15)Cannot execute script in target engine ‘main’! Thanks.
for (var i = 0; i < sortedFiles.length; i++) {
var page = doc.pages.add();
page.appliedMaster = doc.masterSpreads.item(‘A-Master’);
var targetFrame = page.rectangles.add({
geometricBounds: [.9, .5, 10.5, 8],
strokeWeight: 1,
});
try {
targetFrame.place(sortedFiles[i]);
targetFrame.fit(FitOptions.PROPORTIONALLY);
targetFrame.fit(FitOptions.CENTER_CONTENT);
} catch (e) {
$.writeln(e);
continue;
}
}