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

problem with old javascript and acrobat reader X

moxo
Registered: Feb 2 2011
Posts: 4

hello
sorry for my english ;)
i create an javascript used by my users
This javascript permit an advanced search in our documentation composed by a lot of pdf files.
This javascript load very well in reader 7, 8 and 9.
The javascript create 2 buttons in new toolbar and add a sub menu in Tools menu.
One button is to launch our advanced search and the second button is to launch an pdf document who explain the advanced search.
I have two problems.
First
now in Acrobat Reader X i don't have the Tools menu like file, help.. my personnal menu don't launch. I bypassed this problem by using Help menu to host my submenu. But i don't think it's a good bypass. I prefer create my own menu like Help, File, Edit... Is It possible?
 
my second problem.
I use app.addToolButton but it doesn't work in reader X, buttons don't launch. I want to know if is it possible to add a button in the tools bar of reader X after other buttons
 
my script
app.addToolButton({cName "MySearch", cLabel: "My Cie Search", cExec: "mysearchfuntion()" , nPos:-1});
app.addToolButton({cName "Myhelp", cLabel: "Search Help", cExec: "openmyhelp()" , nPos:-1});
 
app.addSubMenu("MyCieMenu","MyCie","Help",0;
app.addMenuItem("MySearch","My Cie Search","MyCieMenu",0,"mysearchfuntion()" );
  
thanks for your help

My Product Information:
Reader, Windows
UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
JavaScript cannot add a new menu, only append items to the existing ones. You'd need to write a plugin to add a new menu, and for Reader that's a very expensive option.

The Quick Tools and system toolbars in Acrobat X / Reader X are not accessible to scripting or plugins, but when you try to add a toolbar button in JavaScript, the UI will place it in a new Pane on the bottom of the Tools Panel instead. A user can choose to drag that button to the Quick Tools area, but you cannot do it for them.
moxo
Registered: Feb 2 2011
Posts: 4
thanks for your answer
i never write a plugin, is it difficult? whats the language used to developp plugin?
when you say it's expensive how many cost? after when the plugin was write, we put only put the plugin in folder plug_ins and after at each launch of acrobat reader, the plugin will launch??

with old script I can see the new button only i click quickly on ctrl+e to have properties of tools bar. but i can drap but not drop this button on the tools bar.
thanks
Nifty
Registered: Jan 16 2011
Posts: 17
Oh bother !!

I have been writing code to install menu items and toolbar buttons too and needed these to run in Reader X as well as Reader 9.

Hmm, might look into the plugin route but I see you need to get it signed off by Adobe at some expense .. probably not worth it !!
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
The menus have changed, but the old menu items exist, but not visible. Toolbar buttons now appear in the "Tools" well. You might be able to add an item in the old menu item, but you will need to add a toolbar button.

Much of Acrobat JavaScript has changed since version 4.0. We have all had to adjust.

George Kaiser

thomp
Expert
Registered: Feb 15 2006
Posts: 4411

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

moxo
Registered: Feb 2 2011
Posts: 4
thanks for your video
i don't have the tool button near comment and share like your video. is it available in reader? if yes how i can bring up this button?
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
No, since JavaScript is used in making dynamic forms, which is a premium action, one needs to purchase at least the Standard version of Acrobat. Reader can execute most of the Acrobat JS except those methods that add script actions or create fields and certain other design and higher level tasks.

You can use a plain text editor to write a JS file to add a toolbar button in an application folder used by Reader to add a toolbar button to Reader. But it can be very hard to design and debug these scripts in Reader.

George Kaiser

try67
Expert
Registered: Oct 30 2008
Posts: 2398
UVSAR wrote:
... but when you try to add a toolbar button in JavaScript, the UI will place it in a new Pane on the bottom of the Tools Panel instead. A user can choose to drag that button to the Quick Tools area, but you cannot do it for them.
This applies only to Acrobat X, of course. There's no Tools panel in Reader X.

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

moxo
Registered: Feb 2 2011
Posts: 4
we change our javascript
now we put our submenu in the Help menu and if the user has Acrobat Reader X we use to launch the property tool bar "app.execMenuItem("PropertyToolbar") ;" and after we can use app.addToolButton. Our button appears in the property tool bar.
We have resolved our problem within use a plug in
try67
Expert
Registered: Oct 30 2008
Posts: 2398
That's a nice one! Where did you hear about this method?
I'm afraid it's a bug instead of a feature, and might disappear in future versions.

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

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, that is definitely a bug. I did several tests. When the properties bar is displayed first, the addToolButton function causes the old Add-ons toolbar to display. This bar gets mixed up, and sometimes merged with Document JS toolbar. And I can get the Document Toolbar to display with no document open.

Also, there actually is a Tools panel in Reader X. Its only displayed when a PDF is Reader Enabled.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script