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

ExtendScript: adding a newline to console messages

Advocate ,
Jun 11, 2020 Jun 11, 2020

Hello fellow scripters,

I have been using Err( 'some text' ) to push messages into the console, but I have failed to find the way to add newlines to those messages. If anyone has done that, please enlighten me on this detail.

Thanks

4everJang

TOPICS
Scripting
1.4K
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

correct answers 2 Correct answers

Enthusiast , Jun 11, 2020 Jun 11, 2020

Hello Jang,

it's a funny thing:

You could use:

Err( 'some text\n' )

or

Err( 'some text\n' )

In both cases a new line is insertet in consfile.txt, but is NOT shownin the FrameMaker console

If you use

Console("some text\r")

or

Console("some text\n")

it works in both, consfile and console

Translate
Enthusiast , Jun 11, 2020 Jun 11, 2020

I normally add  '\r' at the start of a new Console() message. If you don't do that your message my get added to the end of anything that's already there. 

 

Ian

Translate
Enthusiast ,
Jun 11, 2020 Jun 11, 2020

Hello Jang,

it's a funny thing:

You could use:

Err( 'some text\n' )

or

Err( 'some text\n' )

In both cases a new line is insertet in consfile.txt, but is NOT shownin the FrameMaker console

If you use

Console("some text\r")

or

Console("some text\n")

it works in both, consfile and console

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
Enthusiast ,
Jun 11, 2020 Jun 11, 2020

I normally add  '\r' at the start of a new Console() message. If you don't do that your message my get added to the end of anything that's already there. 

 

Ian

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 Expert ,
Sep 21, 2023 Sep 21, 2023

I just tried this which did not work:

lsMessage = "Dummy text";
Err (lsMessage + "\r");
Err (lsMessage + "\r");

And not:

lsMessage = "Dummy text";
Err (lsMessage + "\n");
Err (lsMessage + "\n");

 

Therefore double quotes did not matter.

Only this worked:

lsMessage = "Dummy text";
Err (lsMessage + "\r\n");
Err (lsMessage + "\r\n");

 

I know \r\n also from e.g. Notepad++.

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 Expert ,
Sep 21, 2023 Sep 21, 2023
LATEST

I use \r\n as well. I remember the order by the phrase "registered nurse" 🙂

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 11, 2020 Jun 11, 2020

Klaus and Ian,

Thanks for the info. Strange - the whole world is using \n but Frame decided to go with \r - a blast from the distant past, when the mechanical typewriter did not insert a newline but alo needed a carriage return. I bet most youngsters do not even know what a carriage return means - taking the rental car back to the airport, perhaps? 🙂

Ciao

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