How to Edit Acrobat's Execute a Menu Item List and Run JavaScript
Question details
The user wants to know if they can add or remove custom actions from Adobe Acrobat's Buttons and Actions menu-item list, and how to execute specific menu commands via JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Customizing PDF actions and running menu commands through PDF form buttons or scripts.
- Observed behavior
- The standard user interface in Acrobat does not allow direct editing of the Execute a Menu Item list for adding custom actions.
Before running JavaScript commands in your PDF, ensure that you know the exact internal name of the Acrobat menu item you wish to execute to avoid syntax errors.
Use JavaScript to Execute Internal Menu Commands
Since the 'Execute a Menu Item' list cannot be modified directly via the Acrobat UI, use JavaScript as a workaround to trigger specific menu commands.
Adobe Acrobat restricts direct user interface modifications to the 'Execute a Menu Item' list. However, you can bypass this limitation by attaching a JavaScript action to a button or form field.
To successfully run these commands, you must use the app.execMenuItem() method alongside the precise internal name of the menu command you are trying to trigger.
Launch Adobe Acrobat, open your PDF document, and navigate to the 'Prepare Form' tool from the right-hand pane.
Right-click the button or form field you want to add the action to and select 'Properties' from the context menu.
Go to the 'Actions' tab, choose 'Run a JavaScript' from the 'Select Action' dropdown menu, and click the 'Add' button.
In the JavaScript Editor window, enter `app.execMenuItem("NameOfItem");` (replacing 'NameOfItem' with your exact internal command name) and click 'OK'.

Easily Manage Interactive PDF Actions with WPS Office
Instead of relying on complex JavaScript codes and hidden internal menu names, use WPS PDF to seamlessly manage, edit, and add interactive elements to your PDF documents with an intuitive interface.
- 1. Open your PDF in WPS Office: Download and open WPS Office, then click on 'Open' to load your PDF document into the WPS PDF editor.
- 2. Access the Form tab: Navigate to the 'Form' tab on the top ribbon to access the suite of interactive form tools.
- 3. Insert an interactive element: Select the 'Push Button' or 'Link' tool to add a new actionable area to your document.
- 4. Open properties: Double-click the newly created button or link area to open its properties dialogue box.
- 5. Assign actions visually: Set your desired actions, such as submitting a form, resetting fields, or opening a web link, directly from the visual menu without needing to write custom JavaScript.

Frequently Asked Questions
Can I permanently add custom actions to Acrobat's Execute a Menu Item list?
No, the Execute a Menu Item list cannot be edited or customized through the Acrobat user interface. You must use JavaScript to run custom or unlisted menu commands.
How do I find the correct internal name for a menu command?
You can find internal menu names by consulting the Acrobat SDK documentation, which provides a comprehensive list of commands compatible with the app.execMenuItem() method.
Why is my JavaScript menu command not working in Acrobat?
The command may fail if the internal name is misspelled, if the specific command requires elevated security privileges, or if JavaScript execution is restricted by the PDF's security settings.
Does WPS PDF support interactive form fields?
Yes, WPS PDF supports basic interactive form functions such as filling out fields, inserting links, and standard button actions via a user-friendly interface as a streamlined alternative to complex scripting.




