2 Replies Latest reply on Jun 24, 2009 8:41 AM by SteveCaine

    $.write() and $.writeln() both write line-end character to console?

    SteveCaine

      This may seem like a small thing, but I'm finding it really annoying.

       

      Using the ExtendScript Toolkit in CS4 InDesign on Mac OS X 10.4 (Tiger) to write messages to the JavaScript console, I find that both $.write() and $.writeln() will write a line-end after the string passed in. This seems to be broken re. the docs (page 213 of "JavaScript Tools Guide CS4", available from the Help menu, which describes both calls and only mentions linefeeds for the latter).

       

      Are other people seeing this behavior? Is there a way to fix it, perhaps some property or preference on the JavaScript editor/debugger?

       

      Thanks for any help you can offer.

       

      Steve Caine

        • 1. Re: $.write() and $.writeln() both write line-end character to console?
          Dave Saunders Level 4

          I can certainly reproduce it easily enough. This:

           

           

          $.write("This");

          $.write(" is");

          $.write(" a");

          $.write(" test.");

           

           

          produced:

           

           

          This

          is

          a

          test.

           

          The only workaround (it seems to me) is to build the string in the script and then post it all at once. I confess that I hadn't even realized there was a $.write() function although it ought not to take a rocket scientist to realize that there is.

           

          msg= "";
          array = ["This", " is", " a", " test."]
          for (var j = 0; array.length > j; j++) {
          msg += array[j];
          }
          $.writeln(msg);
          Dave
          • 2. Re: $.write() and $.writeln() both write line-end character to console?
            SteveCaine Level 1

            Yes, that's what I've been doing. But I was hoping there was some way to get the correct behavior -- a preference somewhere, or a property on the $ system object. All my debug-log functions, or at least those that write more than one piece of data per line, have to return strings instead of being able to write to the console directly.

             

            Thanks for your reply, Dave.

             

            Steve Caine