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

How to run imported Javascripts in the debugger?

Community Beginner ,
Feb 28, 2022 Feb 28, 2022

Greetings,

 

I've recently created a script that takes a PDF and splits it up into many pieces, saving the pieces in whatever folder the PDF resides in. I'm searching for the simplest way to have my users use this script. So far my current method is copy - pasting it into the console, highlighting all the text (Ctrl + a), and then hitting Ctrl + enter.

 

After searching around, I found that Acrobat has a Javascripts folder in C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts. I placed my script (saved as .js) in the folder, and enabled the debugger in settings. I now see my script loaded in the debugger, but I cant seem to run it. I assume the green button at the top would execute it, but no luck. I've attached a screenshot, my script is the "page1splitter.js"

 

adobe js error.pngexpand image

Am I missing something? Thanks in advanced!

TOPICS
JavaScript
1.0K
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
1 ACCEPTED SOLUTION
Community Expert ,
Feb 28, 2022 Feb 28, 2022

If they use Acrobat Pro you should place your script in an Action, it's more user-friendly (double-clic to install).


PDF Acrobatic, InDesigner & Photoshoptographer

View solution in original post

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 ,
Feb 28, 2022 Feb 28, 2022

If the script is located in a function you can call that function from the Console.

If it's not in a function then you can't call it, as it executes when the application opens.

 

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 Beginner ,
Feb 28, 2022 Feb 28, 2022

Hey try67,

 

Thanks for providing me with some insight here. The function idea is good, it defeintly would be simpler than my current process. But I'd like to get it even simpler if possible.

 

I was hoping to load the script into the Javasccripts folder, then have a user click on a button of some sort that does the same as highlighting and Ctrl+enter on the text. Do you know if thats possible?

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 ,
Feb 28, 2022 Feb 28, 2022

Of course. You would still need to place the code in a function, but then you could call that function via a button, using the addToolButton method of the app object.

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 ,
Feb 28, 2022 Feb 28, 2022

If they use Acrobat Pro you should place your script in an Action, it's more user-friendly (double-clic to install).


PDF Acrobatic, InDesigner & Photoshoptographer
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 ,
Feb 28, 2022 Feb 28, 2022

Or a Custom Command.  Acrobat provides easy methods for exporting and importing both Actions and Custom Commands.

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Mar 01, 2022 Mar 01, 2022
LATEST

Thank you both! I ended up putting my script in an action (New Action > More Tools > Execute Javascript). Going to play around with the exporting now, but this works for me either way. Cheers!

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