Skip to main content
Participant
February 22, 2016
Question

Once I've created your JavaScript, how do I get it assigned to a button that I can add to the toolbar without buying a toolset? Thanks!

  • February 22, 2016
  • 2 replies
  • 965 views

I have created a javascript to automate some functions for various users and need to add a button to the toolbar to launch it.  How do I do this without having to purchase a toolkit?

Thanks so much for any help.

This topic has been closed for replies.

2 replies

Karl Heinz  Kremer
Community Expert
Community Expert
February 22, 2016

If you have Adobe Acrobat DC Pro, you can also create custom commands to execute your JavaScript: Create Custom Commands in Adobe Acrobat DC Pro - KHKonsulting LLC

try67
Community Expert
Community Expert
February 22, 2016

Read about the addToolButton and addMenuItem methods of the app object.

You can use the former like this, basically:

app.addToolButton({

    cName: "myToolButton", // internal name, must be unique

    cLabel: "My Function", // the text of the button the user sees

    cExec: "myFunction();", // the code to execute when the button is clicked

    cTooltext: "Click here to run my function", // the tooltip text for the button

    cEnable: true // when the button is enabled/disabled

});

And then your actual code is placed inside of myFunction:

function myFunction() {

    app.alert("Hello!",3);

}

Participant
February 22, 2016

Thanks!

Karl Heinz  Kremer
Community Expert
Community Expert
February 22, 2016

Great!  How do I add it to the toolbar.  I went to Customize, but cannot find the JS in AddOns or in Javascript.  I did save it to the user JS folder.

Thanks!


Is this regarding the custom commands? You will have to copy your JavaScript from the folder level script into the custom command, or call the JavaScript function you've defined from within the custom command.