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

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!

New Here ,
Feb 22, 2016 Feb 22, 2016

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.

TOPICS
Acrobat SDK and JavaScript
881
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 22, 2016 Feb 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);

}

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 ,
Feb 22, 2016 Feb 22, 2016

Thanks!

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 ,
Feb 22, 2016 Feb 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!

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 22, 2016 Feb 22, 2016
LATEST

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.

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 22, 2016 Feb 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

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