Skip to main content
Inspiring
January 2, 2020
Answered

Replace Pages

  • January 2, 2020
  • 1 reply
  • 1835 views

Hi i just need to show up dialog window.
Because its impossible to set shortcut to replace pages, all i need is show dialog windows. The same dialog window when i click on replace pages, window has name CZ - Vyberte soubor s novými stránkami ENG - Select File With New Pages. Can some one please post JS code? I believe it will be 3 lines code max. The rest i will do with AutoHotkey script.
Many Thanks
EDIT:  in active document of course 🙂

Screen here:
https://ctrlv.cz/hLzy

This topic has been closed for replies.
Correct answer Thom Parker

The JavaScript menu item runs JavaScript. Just typing in "ReplacePages" doesn't do it. 

 

The JavaScript you need was provided by Try67.  So here's what your code needs to look like:

 

app.addMenuItem ({cName: "Nahradit stránky", cParent: "Edit", cExec: 'app.execMenuItem("ReplacePages")'});

 

Note the change in quotes. This is necessary because the execMenuItem code uses a quoted string, and is itself quoted. 

 

Here's an article on how this is done:

https://acrobatusers.com/tutorials/print/add_custom_menu_items/

And you can find out lots more about creating automation tools for Acrobat Here:

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

1 reply

try67
Community Expert
Community Expert
January 2, 2020

app.execMenuItem("ReplacePages");

zuzu_kuc1Author
Inspiring
January 2, 2020

Thank you, BUT...  🙂
i cant add a shortcut even a Javascript so i tried created new menu item (then i can use Autohotkey) but can you help me with this please:
app.addMenuItem ({cName: "Nahradit stránky", cParent: "Edit", cExec: "ReplacePages" });
I get a error: internal error.

https://ctrlv.cz/wRqK

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 2, 2020

The JavaScript menu item runs JavaScript. Just typing in "ReplacePages" doesn't do it. 

 

The JavaScript you need was provided by Try67.  So here's what your code needs to look like:

 

app.addMenuItem ({cName: "Nahradit stránky", cParent: "Edit", cExec: 'app.execMenuItem("ReplacePages")'});

 

Note the change in quotes. This is necessary because the execMenuItem code uses a quoted string, and is itself quoted. 

 

Here's an article on how this is done:

https://acrobatusers.com/tutorials/print/add_custom_menu_items/

And you can find out lots more about creating automation tools for Acrobat Here:

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

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