3 Replies Latest reply on Dec 14, 2010 12:30 PM by George_Johnson

    Quick script help/modification needed.

    dpopovici

      I've searched the forums but can't seem to find what I need. I found the original script here and modified it slightly to fit what I need besides one detail. I have this as a Batch Process as I will have to apply this to multiple documents. Right now, it will save it with the date and time the batch is run, then updates the date when it's printed. I would like to have the date updated when the document is opened as well. If you are able to help me with this, that would be greatly appreciated. Thanks for taking a look!

       


      for (var p = 0; p < this.numPages; p++)
      {
      var fd = this.addField("Date", "text", p, [72,66,540,50]);
      fd.textSize=8;
      fd.value = "This is a Controlled Document.    Printed copies are valid for 24hrs past: " + util.printd('dddd dd mmmm yyyy    h:MM tt', new Date());
      fd.allignment = "right";
      fd.fillColor = color.transparent;
      fd.textColor = color.red;
      fd.borderColor = color.red;
      fd.readonly = true;

      var txtWillPrint = 'var d = this.dirty;\r'
      + 'var fd = this.getField("Date");\r'
      + 'fd.value = "This is a Controlled Document.    Printed copies are valid for 24hrs past: " + '
      + 'util.printd("dddd mmmm dd yyyy     h:MM tt", new Date());\r'
      + 'this.dirty = d;';

      this.setAction("WillPrint", txtWillPrint);

      }