Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Community Beginner ,
Jun 23, 2009 Jun 23, 2009

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

TOPICS
Scripting
4.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 24, 2009 Jun 24, 2009

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;
}
$.writeln(msg);
Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2009 Jun 24, 2009
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines