Hello all. I'm commonly on this forum researching problems, but have never posted before. Hopefully you can help me as you've helped many others.
I've been manually adding a javascript to PDF's. All the javascript does is to open a pop-up window with a message whenever a PDF is opened. I've been adding the script by going to Advanced > Document Processing > Document Javascripts > Add, then I paste in this bit of code:
var UsageAgreement = "This text is what shows up in the pop-up window"
app.alert(UsageAgreement,3);
Since I have to do this literally hundreds of times I'm trying to make a batch which will insert this code into every PDF at once. I'm very close, but can't get it to work. I was told to use this code:
this.addScript("Script name goes here", 'Script goes here');
But when I change the "Script name goes here" to my script name, and replace "Script goes here" with my script, like this:
this.addScript("UsageAgreement", 'var UsageAgreement = "This text is what shows up in the pop-up window"
app.alert(UsageAgreement,3);');
It doesn't work and gives me an "unterminated string literal" error. If I remove the "var UsageAgreement" and "app.alert" parts, it will correctly insert the "This text is what shows up in the pop-up window" into the javascript field of every document, but the pop-up window won't work without those commands.
Any help would be appreciated.
this.addScript("UsageAgreement", "var UsageAgreement = 'This text is what shows up in the pop-up window';\
app.alert(UsageAgreement,3);");
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com