Hi Everyone,
I'm a bit turned around here, and I'm hoping someone can point me in the right direction. I am trying to make a batch process to update the contents of a Combobox that I have on a few hundred forms. The form is an FCC document and the Combobox contains addresses for different locations in the US that I ship to frequently(I have hundreds of them because of the numerous different commodities that need to be shipped). The Combobox is set up to populate a text field in the form with the correct address based on the location name chosen from the list. To do this I have a custom keystroke script that I have input in the "format" tab of the Combobox. This script matches an items export value with an array containing the addresses, and then populates the appropriate field. At this point everything is working well. The problem now is that I need to add a couple of addresses to the array, and the corresponding items to the Combobox, and I need to distribute that change throughout all of my forms.
I have been trying to set up a batch action that will create a new Combobox with the appropriate items and export values. The part I am stuck on is how to get the custom Keystroke script that contains my address array into the newly created Combobox. Would this be done through setAction using the cScript parameter? If so then maybe I need a bit of help with how to properly add a script within that parameter (syntax etc.) I should also mention that if there is a way to overwrite the script in the combobox I already have set up, that would be a preferable course.
I am quite new to JavaScript, but have managed to bungle my way in this far with the help of this forum and our good friend Google. If anyone can help me clarify this I would greatly appreciate it.
You find detailed info on modifying list fields(i.e. combobox) in this article.
http://acrobatusers.com/tutorials/2007/js_list_combo_livecycle/
I suspect that you need to modify the script because the address information is contained in it? And that this script is very long? Since you are new to JS this is going to cause a problem. There are a lot of small details for getting this process right, such as setting up the scripts as a string, which means escaping quotes and line feeds. However, once you create the batch process it well become easy to make future changes.
Now, I mentioned that you have lots of options. It may be easier to go another route. One thing you can do is remove the location selection from the forms altogether. Look at this article:
http://acrobatusers.com/articles/getting-external-data-acrobat-x-javascript
Using the information in this article, you can create a folder level script that allows the keystroke script to access data in an external file. Or you can create an automation script that removes the process entirely from the actual form.
I also just wrote up a set of really detailed articles and examples on lists and auto-populating form data at www.pdfscripting.com. This is a membership site all about learning and using Acrobat JavaScript. I think you'll find it massively useful.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script