get filename of open doc
I have a bunch of documents named similar to the following:
ThisProduct_01-TEXT.pdf
ThisProduct_02-TEXT.pdf
and JPG covers for them:
ThisProduct_01-COVER-FRONT.jpg
ThisProduct_01-COVER-BACK.jpg
ThisProduct_02-COVER-FRONT.jpg
ThisProduct_02-COVER-BACK.jpg
(etc.)
What I currently have:
I have a working script that works as follows:
[1] Before running script > Open a PDF, then drop the two cover images at the front of the doc.
[2] Run script > Script moves cover JPGs to correct place and renumbers pages accordingly.
What I want to be able to do:
I want to be able to have JS access the filename of the currently open document so that I can then run some string replacements that enable it to automatically find the JPGs and run the rest of the script that I have working. The workflow would look like this
[1] Open document
[2] Run script
... and there is no messing around trying to find the right images as Acrobat JS determines what they are called based on the open filename
My Question:
How can I retrieve the filename of the currently open document using JS?
The simplest thing for me would be a demo JS that when run just states the name of the file, then I could figure out the rest (string replacements and so on) myself.
Can anyone help with this bit? I found a few similar solutions but couldn't quite figure out if they needed a list of filenames supplied and so on, I couldn't tell if they were for the open document.
