Executing .js file using Action Wizard

I want to run a script.js file, but not automatically upon file open, or as part of any Document Actions (eg, Save, Close, etc).
That is, I want it available as an Action to be run manually only as/when needed.
I have an Action set up that will execute javascript, but not when all the code is pasted into that dialog box. For it to work, I have to include the code as a Document Javascript, and then include only the function() call in the Action Steps to run it. I don't want the code to reside in any of the files against which I will run it.

So, to run it against individual files, only as/when needed, how to point the Action Wizard to the .js file - which is located in the jscache directory? (Or it could be moved to javascripts dir if required.)

Thank you,
Dave


Dave ReasonJr


5 Answers

Voted Best Answer

First of all, it has to be in the JavaScripts folder. And it works just like a doc-level script. You place your code in a function and then call that function from your Action. That's it.

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


By Gilad D (try67)   

I moved .js file to
C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts

In Action Wizard, there is only one line of code in the Execute JavaScript Action. I've used copy/paste to make sure the function call is same text as what's in the code.


The Action appears to run without errors, but no changes are made in the pdf file.


If I copy the code into a Document Script, and then run the Action, it works.


Any thoughts?

Dave


Dave ReasonJr   

What does your code do, exactly?

Also, did you remember to add a Save command to your Action?

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


Gilad D (try67)   

There are reasons your code may work from the document level but not from the folder level. One example is if you haven't properly identified the document, ie getField("theField") vs this.getField("theField"). You might get away with the former in a document but not calling a function from the js folder. A test you can perform is to run the function in the console (ctrl + j). First, did the function execute properly and make the changes? Next, are there any errors in the console. You can probably save yourself and your respondents a lot of time if you provide your script once you have followed the original advice that doesn't seem to have worked.

________________________________________________________________________________________________________________

David Dagley, CFP®
Developer at

www.PDFAutomationStation.com

IMAGE ALT TEXT IMAGE ALT TEXT IMAGE ALT TEXT

_________________________________________________________________________________________________________________


David Dagley   

Do you want to run this script as a tool in an open PDF or as group of files being processed by the Action Wizard or Batch Processor.

If you want to run it on any open PDF file as a tool, then you need to place it on one of the application folders for JavaScript and then create a tool bar button or menu item to call the script. With this option it is even possible to call the folder level script within a Action Wizard process or batch process.

Within the Action Wizard or Batch Process one can insert JavaScript that is only available by running the Action Wizard Process or Batch Process.


George Kaiser   


Please specify a reason: