Copy link to clipboard
Copied
This seems like it must be a super basic issue, but I wrote some JavaScript code for a pdf using the "Edit All JavaScripts" butoon, but whenever I click "OK" to save/close out the code/script editor, it all clears out and all I am left with is the
//------
//----Do not edit the XML tags
//---------
code.
So basically nothing I do is getting saved, whether or not my code is any good.
Any idea what I am doing wrong? Thanks!
Despite its name, do NOT use this command to edit the code in your file. It can seriously damage it.
Copy link to clipboard
Copied
What else did you put there? Basically this is a handy way of viewing all your existing scripts. Not a place to type it all in - how would it know where to put it...?
Copy link to clipboard
Copied
I have all of my code on a notepad file and have been trying to copy and paste it into "edit all JavaScripts". That has worked for me previously but I guess not this time.
So where is the best place to type in the script?
Copy link to clipboard
Copied
Despite its name, do NOT use this command to edit the code in your file. It can seriously damage it.
Copy link to clipboard
Copied
Gotcha, so where is the best place to edit the code?
Copy link to clipboard
Copied
I would recomend saving any js script you wish to use as a folder level script by saving its .js file in: \AppData\Roaming\Adobe\Acrobat\Privileged\2017\JavaScripts.
You can then test and run it by using the acrobat JS console or better yet, using an action wizard to call your JS code.
Copy link to clipboard
Copied
For testing purposes it's easier to do it all from the Console, not from a folder-level script as you will need to restart the application after each update to the script if you do the latter, which can get pretty annoying.
Copy link to clipboard
Copied
Code in PDF forms and Acrobat likely goes to five different places, each edited separately (and I probably forgot some).
1. Event related code (like, when I click this button run this code). This must be edited with the form editor for the form element.
2. Document level scripts. Use the document level script editor.
3. Batch actions. Edit in the batch action editor.
4. Acrobat startup scripts not connected to any document. Add to startup folder.
5. Immediate scripts, to run right now. Use the JavaScript console. This isn't an editor, so edit externally, and paste to run.