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

Memory of Javascript actions

barrelracingreport
Registered: Jan 11 2008
Posts: 17

I use the Javascript Link Tool to create links to other websites off of our pdf publication. I use the Run a Javascript thing so that the websites open in a new window. Anyway, my question is, is there anyway to have these kept in the memory somehow so I don't have to retype the Javascript command each week. For instance, under the command open a web link it has a drop down menu of all the commands typed in, in the past. Any ideas? Thanks.

My Product Information:
Acrobat Standard 8.1.2, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The easiest way is to create a text file with all your code in it and just copy and paste. But you could make this job much, much easier by writing an automation JavaScript that would create you're links for you. This could be done a variety of ways depending on you exact workflow. See these articles on automating form field and annotation placment.

http://www.acrobatusers.com/tutorials/2007/10/auto_placement_annotations/
http://www.acrobatusers.com/tutorials/2007/js_add_buttons_to_pdf/

Also take a look at the "doc.addLink" function in the Acrobat JavaScript Reference. There are examples for automating link placement.

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

barrelracingreport
Registered: Jan 11 2008
Posts: 17
OK. I looked at both the links you sent and I am not sure I understand it
fully. If you go to www.barrelracingreport.com on the home page is the
Report as we call it which is a pdf document. Then you can see the document
I am talking about. We sell ads within the document and these are the ones
we link to their websites. The ads move every week and such so I don't think
the buttons and such would work for us. Basically, I am trying to figure out
how to get the Run JavaScript function to in Acrobat to keep a memory of the
actions I use we use the command - app.launchURL("http://www.mycompany.com",
true)

to make the links work.



In the Open A Link way of linking it keeps a memory however it will not open
in a new window so then if someone clicks on something when they go back to
our pdf they would have to wait for a 2-3 mb document to download again.

Any suggestions?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Forget the link tool, it doesn't remember Scripts that were entered in the past. If you want to save and reuse scripts then you have to write an automation script. This is a script that runs in the context Acrobat and not in the context of a document.

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

barrelracingreport
Registered: Jan 11 2008
Posts: 17
Thank you for your help. I don't understand JavaScript very well but I will study those two articles more and try to educate myself to where I understand what you are saying. Thanks and I will get to learning!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If you are a beginner with JS, then I would stronly suggest making up a plain text file containing all the scripts that you use, then copy and paste from this file.

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