Run Adobe Javascript without an open document
Copy link to clipboard
Copied
Hello,
Is there a way to run javascript without an open document? Action Wizard requires documents to be open to run javascript, but I'm questioning the purpose of the app.openDoc function?
Right now, I'm trying to create a Microsoft Power Automate Desktop flow that runs some javascript through Acrobat. Unfortunately, the UI for acrobat is a nightmare so anything that can help me avoid clicking buttons (including clicking on the action wizard tool) and instead allow me to run javascript to run my process would be ideal.
Copy link to clipboard
Copied
You can place your code in a function under a folder-level script and then call it, even when no files are open.
However, if you want to use that to process files that's going to be problematic. For starters, openDoc will only return a Document object if the file you open is disclosed.
Copy link to clipboard
Copied
Thanks for the reply!
I'm pretty new to JavaScript so forgive me for being inexperienced, but can you explain the disclosed issue a little further?
From my understanding setting a document to disclosed is something I have to do on the document level scripts. Is that correct?
I am using Power Automate Desktop and if I have to I can use powershell along side Acrobat JavaScript. So where I may be limited in one I can hopefully make up in another.
Copy link to clipboard
Copied
Yes, that's correct. Basically all it takes is embedding the following code in a document-level script, so that it executes when the file is opened:
this.disclosed = true;
Copy link to clipboard
Copied
Could I work around this issue by creating a blank document that has the this.disclosed = true; then place my actual document in there and continue running the rest of my script?
I need to do 3 main things with my documents. They are client statements so I need to:
- Delete every page except the first and save the document
- In this case I delete every page but the second, since the first page will be blank.
- Export the single page document as an excel file
- Merge all the single page documents
I have all these parts seperate currently, but I'm trying to build it as one script to reduce the amount of clicks I need to do.
Copy link to clipboard
Copied
That might work... Worth a shot!
Copy link to clipboard
Copied
@Kasandra Have you been able to figure out this process? Would you be willing to share it here?
Copy link to clipboard
Copied
I did not. I actually worked it so I could completely move the process outside of Acrobat. I'm using Power Automate Desktop for a lot of processes so I just built my invoices in Excel to avoid acrobat.

