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

Using Javascript to open advanced search window and a specific index in Adobe Reader

Nifty
Registered: Jan 16 2011
Posts: 17

Dear All,
 
I've signed up here in the hope that someone may be able to help me.
 
I have compiled over the years a collection of information in PDF form to make a library of information for my colleagues (agricultural advisory business).
The library is controlled by using menu pages with buttons that link to and from bookmarked documents.
I am currently using Acrobat 8.0 Pro to do my assembly work and my colleagues will be using either Reader 8 or Reader 9 to view it (though may soon upgrade to Reader X).
 
Everytime we update the library we compile an index file (.pdx). The end user is then required to search for this file on his C drive to select it for searching the library, something quite a number struggle with or simply don't do. As a result I would like to automate this process so I create a search button that automatically opens the advanced search box with the correct index selected. I thought I'd cracked it when I simply linked my Search button to the correct PDX file - in Acrobat this worked, however on Reader it wouldn't work since it "didn't recognise the program needed to open the PDX file".
 
I have recently become aware of Acrobat Javascript and wondered whether this would be the solution to my problem, if script could be written that automated the process in Reader of opening the advanced search box and then selecting the correct index.
 
Being a complete beginner with Javascript and only having done very basic VBA in Excel before I am hoping someone will not only confirm whether it would be possible to do what I wish, but also perhaps if they might be kind enough to help me with the code.
 
Many thanks,
 
Nifty.

My Product Information:
Acrobat Pro 8.1.7, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Have you tried specifying the index in the document: File > Properties > Advanced > Search Index
Nifty
Registered: Jan 16 2011
Posts: 17
George,

Thank you for taking the time to answer.
I possibly didn't explain clearly what I was after.
However, .........



EUREKA !!

It's here:

http://acrobatusers.com/tutorials/custom-document-search-using-javascript

Just the info I was after to get me started.
Now I just need to consult the Javascript Reference to learn all the possible functions etc to build my own search dialog.

Nifty.
Nifty
Registered: Jan 16 2011
Posts: 17
Losing a lot of sleep over this.

Creating the dialog boxes using AcroDialog has been easy.
Getting the various functions within the dialog to work is proving considerably harder. A lot of the code found in the form example above doesn't want to work within the confines of a dialog box.

I have two fundamental issues/questions.

Firstly,is it possible and if so how, to take a text value entered into a text edit box and use that in another dialog element before running the commit function.

Is it possible to create javascript that will close down (cancel) the dialog from a normal button.
I do not wish to use an OK_Cancel button arrangement because I wish to use a single OK button, enlarged and renamed to SEARCH to execute the end product of the dialogue box.
Nifty
Registered: Jan 16 2011
Posts: 17
Have made a huge amount of progress with this thanks to WindJacks AcroDialogs and Thom Parkers assistance.
I'll post up my solution code when I have completed it to help others who might be searching this area in the future.