Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Run Adobe Javascript without an open document

Participant ,
Jun 14, 2021 Jun 14, 2021

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.

TOPICS
How to , JavaScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2021 Jun 15, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 15, 2021 Jun 15, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2021 Jun 15, 2021

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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 15, 2021 Jun 15, 2021

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:

  1. Delete every page except the first and save the document
    1. In this case I delete every page but the second, since the first page will be blank.
  2. Export the single page document as an excel file
  3. 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2021 Jun 15, 2021

That might work... Worth a shot!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2022 Jun 15, 2022

@Kasandra Have you been able to figure out this process? Would you be willing to share it here?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 15, 2022 Jun 15, 2022
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines