Within a document-level script, the general answer is no. The Acrobat JS API isn't permitted to browse the local file system without the user explicitly choosing the file from an "Open file" dialog box first, but if your script *does* prompt the user to choose a file and they somehow pass you an invalid reference (such as a file without read permissions), your script can catch the error.
Folder-level scripts with elevated permissions can open hard-coded file paths but cannot browse the folder tree.
1 person found this helpful
You can use openDoc on a certain path. If it returns null, the file doesn't
exist. If it throws a security error, it exists but is not disclosed.
Thank you both for your answers!
My script is app-level and brings various PDF assets together, some as watermarks and others as appended documents. All assets should be in predefined paths. I wanted the script to execute automation tasks if everything is found or have a dialog pop up for browsing to assets that are not found.
I assume I'd need to attempt an app.openDoc() on each asset and close them out on success. If there are any errors caught, the script would open the dialog to browse for missing assets.
Is there a way to make the app.openDoc() calls invisible to the user?