These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How make shortcut to Advanced|Document Processing|Batch Processing?

FUBARinSFO
Registered: Apr 11 2007
Posts: 61
Answered

Hi

How make shortcut to Advanced|Document Processing|Batch Processing? Doing a lot of debugging of batch sequences and each change drops me back to the pdf, so this continuous renavigation is getting pretty old.

Thanks in advance for any suggestion (other than Automate, say).

-- Roy Zider

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Make a new menu item with this code:
app.execMenuItem("BatchEdit");

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Is it possible to add a shortcut when adding a new JavaScript menu item ?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You mean a keyboard shortcut? No.
But you can add an accelerator to a menu item by adding an ampersand to it before the letter used as the accelerator.

Actually, in the original post I meant to say "make a new toolbar icon", since it's more accessible.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

FUBARinSFO
Registered: Apr 11 2007
Posts: 61
try67:

I'm unclear on how that puts a button on the menubar or toolbar. I created a sequence, javascript, and executed it -- but had to navigate manually to the batch processing branch to run it I'm trying to one-click to that part, so I can re-edit my sequences. (or said another way, I'm unclear as to how to link javascript snippet like this to a custom button on the toolbar)
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You need to create a folder-level script with app.addToolButton and use this snippet of code as the cExec parameter of your button.
Look in the reference file for more info.
Be aware that this code will only open the Batch window. It can not launch, or edit, any batch process in that window. That can't be done with JS.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
try67 wrote:
But you can add an accelerator to a menu item by adding an ampersand to it before the letter used as the accelerator.
Please explain "Ampersand".

English isn't my native langage and I can't find this word in any dictionary…

;-)
FUBARinSFO
Registered: Apr 11 2007
Posts: 61
try67:

Ugh -- I was afraid of that. "RTFM" isn't going to happen right now, as it's 2:35 am and I'm trying to get some dox ready to fax and mail. But thanks for the code, and perhaps I can get to it in a day or two. Can't believe there's not a simpler way to do this.

-- Roy
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Ampersand = &

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Save this into a js file, place it in Acrobat's Javascripts folder and restart Acrobat:

app.addToolButton({cName: "Open Batch Window", cLabel:"Open Batch Window", cExec:"app.execMenuItem('BatchEdit');"}):

But next time RTFM...

(Edit: code is not tested)

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
try67 wrote:
Ampersand = &
Thanks !

Ampersand mean "Esperluette" in french language.

;-)
FUBARinSFO
Registered: Apr 11 2007
Posts: 61
try67:

You know, coding lis like a key -- if you have the key, you can open doors. If not, you need something blunter.

It's 5:07 am here on the Left Coast, and I'm going to get a couple of hours rest. I will try your key when I get back to the console. It looks right -- thank you so much.

-- Roy
FUBARinSFO
Registered: Apr 11 2007
Posts: 61
try67:

The target path is to make shortcut to Advanced|Document Processing|Batch Processing. Soyour text 'BatchEdit' generates an 'invalid label' error on startup.

But even changing this to 'Batch Processing' doesn't navigate to the combo box, so there must be something more to it that I'm missing.

May have time tomorrow to take this up again.

app.addToolButton({
cName: "myButton",
cLabel: "myButton",
cExec: "app.execMenuItem('Batch Processing');"});
leeschill
Registered: Sep 23 2009
Posts: 2
FUBARinSFO wrote:
try67:You know, coding lis like a key -- if you have the key, you can open doors. If not, you need something blunter.

It's 5:07 am here on the Left Coast, and I'm going to get a couple of hours rest. I will try your key when I get back to the console. It looks right -- thank you so much.

-- Roy
FUBARinSFO
Registered: Apr 11 2007
Posts: 61
Here's the solution. It turned out that 'BatchEdit' is not one of the items that can be executed outside of a privileged or secure wrapper. I've added a line to prevent the button from calling up the batch processing combo box if there's no document; just comment out the line 'cEnable' to disable this and the box will come up when there's no doc in view.

See the link below for clues as to how to solve this problem.

-- Roy Zider

1. Here is the article that addresses this problem:

Executing Acrobat Menu Items from JavaScript
http://www.acrobatusers.com/tutorials/2008/06/executing_menu_items_from_javascript
By Thom Parker, June 30, 2008

2. Here is code that actually works, in Acrobat 8:
--------------------------------------------------
var doMyMenuItem = app.trustedFunction(
function(cItemName)
{
app.beginPriv();
app.execMenuItem(cItemName);
app.endPriv();
}
);app.addToolButton(
{
cName: "myButton",
cLabel: "myButton",
cEnable: "event.rc = (app.doc != null);",
cExec: "doMyMenuItem('BatchEdit');"
}
);
--------------------------------------------------
Mervin
Registered: Oct 8 2009
Posts: 6
FUBARinSFO wrote:
Here's the solution. It turned out that 'BatchEdit' is not one of the items that can be executed outside of a privileged or secure wrapper. I've added a line to prevent the button from calling up the batch processing combo box if there's no document; just comment out the line 'cEnable' to disable this and the box will come up when there's no doc in view.See the link below for clues as to how to solve this problem.

-- Roy Zider

1. Here is the article that addresses this problem:

Executing Acrobat Menu Items from JavaScript
http://www.acrobatusers.com/tutorials/2008/06/executing_menu_items_from_javascript
By Thom Parker, June 30, 2008

2. Here is code that actually works, in Acrobat 8:
--------------------------------------------------
var doMyMenuItem = app.trustedFunction(
function(cItemName)
{
app.beginPriv();
app.execMenuItem(cItemName);
app.endPriv();
}
);

app.addToolButton(
{
cName: "myButton",
cLabel: "myButton",
cEnable: "event.rc = (app.doc != null);",
cExec: "doMyMenuItem('BatchEdit');"
}
);
--------------------------------------------------
Hi,

I was very delighted to have found this forum. I work in an a prepress outfit that intensively utilizes Acrobat. This thread was a lot of help and answered my questions about batch processing shortcut.

One thing though...

I have successfully created a toolbar button using the script above, but i noticed that it is inactive (grayed-out) when there is no document open. I usually use sequences to batch process an entire folder of large documents and it would be to heavy and time-consuming to open all those.

This is my first encounter with JavaScript (or any programming language) and I am a little intimidated, but i hope there is a tweak to the script that would make the button active at all times.

Thanks.

-----------------
Under extreme conditions of temperature, pressure and humidity, this organism tends to do as it damn well pleases...

Mervin
Registered: Oct 8 2009
Posts: 6
OH! GOT IT!

"...I've added a line to prevent the button from calling up the batch processing combo box if there's no document; just comment out the line 'cEnable' to disable this and the box will come up when there's no doc in view."


... I missed this...

-----------------
Under extreme conditions of temperature, pressure and humidity, this organism tends to do as it damn well pleases...

FUBARinSFO
Registered: Apr 11 2007
Posts: 61
Mervin wrote:
OH! GOT IT!"...I've added a line to prevent the button from calling up the batch processing combo box if there's no document; just comment out the line 'cEnable' to disable this and the box will come up when there's no doc in view."


... I missed this...
Great to hear that, Mervin. Always good to know that somebody else can use this stuff.

-- Roy Zider