I've recently been looking into automating a few things in Acrobat through JavaScript and had a couple questions that came up. I'm wondering if anyone might have thoughts or tips on these, it would be appreciated!
Two tricks that I've seen suggested for checking to see if a file exists are to either import it as an attachment, or attempt to open the file and see what the result is. e.g. if (this.importDataObject("myFile", "/testfile.pdf/")) { This doesn't seem to work well for my situation as the files in question can be quite large, and importing or opening them can be slow.
For question #1 - Short answer is "No". As you said, Acrobat JavaScript doesn't have access to the file system. Long answer is "Yes - depending on what you want to do". Acrobat has a way to run "Actions" that can process all the files in a given directory, a list of files, or all the files that are currently open. You can run JavaScript on each file in a directory using an action without that script needing to actually know the file name.
For Question #2. The only option you have to set a link action via JavaScript is to set the JavaScript action. If you create a link, you only get to set the mouse up action. However, you can add a button instead of a link where the background and border are transparent and there's no caption and you get something that visually looks like a link but you can set more actions like mouse up, down, and rollover (enter/exit).