InvalidDocumentError when using Action Wizard
I am trying to run a date stamp script through action wizard, which works when run on a single file through the console. The script is
for (var p = 0; p < this.numPages; p++) {var f = this.addField("Date", "text", p, [350, 770, 600, 790] ); f.value = "Document Received: " + util.printd("mm/dd/yy hh:MM:sstt", new Date());}
When run I get the error InvalidDocumentError: Method called on invalid document objec: document.addField().
Thanks for the help!