1 Reply Latest reply on Dec 7, 2011 2:03 PM by George_Johnson

    multi-line box using JavaScript

    harringg_ Level 1

      I'm using this script from ReinhardF who posted it in another forum.


      Is it possible to modify it to:

      1. Make a multi-line text box from the JS code?

      Re: when the text font is too large (and the path is too long for one line), I have to manually select properites of the text box and check the Multi-Line box.

      2. Make it just truncate the this.path output?  It displays the full file path, and I'd like to be able to control how far down the folder path the file name goes.  Re: I have a folder on computer A that the PDF file is saved to and printed from.  I then backup that up to a publicy accessible computer drive (B) which has a slightly different file path.





      What I'm wondering is if I could concatonate the JS generated path to only include: ProjectA/Results/111205_Result1.pdf



      app.addMenuItem({cName:"Print with Footer", cParent:"File", nPos:20, cExec:"PrtFooter();"});


      //Print bookmarked Pages

      function PrtFooter()



      for (var p = 0; p < this.numPages; p++)




      var fd = this.addField("Date", "text", p, [10,15,545,55]);

      fd.textSize=12; fd.value = "Print Date: " + util.printd("yyyy/mmm/dd", new Date()) + " (" + this.path +")"


      // (Original) var fp = this.addField(String("page"+p+1), "text", p, [330,10,280,28]);

      //var fp = this.addField(String("page"+p+1), "text", p, [300,10,400,20]);


      //fp.textSize=8; fp.value = "Page: " + String(p+1)+ "/" + this.numPages;






      var OK = app.alert("Delete Date / Filename?",2,2);


      if (OK == 4) {


      var x = removeField("Date");


      for (var p = 0; p < this.numPages; p++)




      var x = removeField(String("page"+p+1));


      } }



        • 1. Re: multi-line box using JavaScript
          George_Johnson MVP & Adobe Community Professional

          Consider code like this:



          var sPath = "computerA/Folder1/SubFolder1/ProjectA/Results/111205_Result1.pdf";
          var aPath = sPath.split("/");
          var sPartialPath = sPath;
          if (aPath.length > 2) {
              // returns "ProjectA/Results/111205_Result1.pdf"
              sPartialPath = aPath.slice(-3).join("/");


          When you create the form field, you can then set the multiline property to true. Is there a reason you don't want to set the font size to Auto (0) so the font automatically decreases?