In a folder-level script I'm using app.openDoc to open an existing PDF and extract an icon from it. The following code works in Acrobat 11 but in Reader X I get a NotAllowedError: Security settings prevent access to this property or method error.

Just for testing, what I would try next is hardcoding the path as well as using a different location for the file. Have you confirmed that the path you get with app.getPath is what you expect? Also, have you double checked that the file actually exists there and can be opened in Reader?

I've also tried hardcoding the path without luck. I've tried hardcoding the path to the Javascripts directory in which the images PDF file resides. I've tried putting that images PDF in the root C: drive as well as a couple of other locations and hardcoded the path to those locations. Nothing has worked.

Getting this.disclosed wrong won't in any case stop the app.openDoc from working. What it will do is cause app.openDoc to return null, so you can't do anything firther with it. So that's not where to focus just yet.

I now believe this is a timing issue. I can get this code to work only if I launch Reader, wait several seconds, and then open my PDF document. If I open the PDF document immediately after launching Reader, or if I open the PDF directly from the file system, then then it doesn't work (NotAllowedError).

My code is at the top level of the Javascript file -- it's not in an event handler or anything. Should it be?

It gets called from the top level of the javascript file. Here's an example -- the exact contents of my javascript file -- where I simply load the icon and display the width in a pop up alert. If I open a PDF from the file system then this generates the same NotAllowedError during the call to app.openDoc(). But, if I launch Reader and wait before opening the PDF, the code runs fine and the correct icon width gets alerted to me.

I still haven't solved this issue but I think I understand the nature of the problem.

app.OpenDoc fails in a folder-level script during startup if the application is opening another document at the same time. (Because of the security restrictions I can't tell if this will happen while any document is open or only during the process of opening one.) I'm seeing this problem in Reader 10 but not Reader 9 or Acrobat 11.

I'm not sure how to work around this. I'm already using a trusted function with privileges. Disabling Protected Mode doesn't help. Would I have more luck putting my code in an event handler, if that's even possible in a folder-level script? Maybe there's another way to load my icon? (I've already tried loading the image from a hex value embedded in the script to no avail. For some reason it significantly degrades the image's quality.)