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

Photoshop Script Not Displaying Line Breaks Correctly

Contributor ,
Jan 17, 2025 Jan 17, 2025
 

 

app.activeDocument.activeLayer.textItem.contents = "Photoshop\r2025";

 

The above code can break lines correctly.
 
The text below, read from 1.txt, does not break lines. Why is that? How can I make it break lines when reading from a txt file? I know paragraphs can break lines, but I don't want to use paragraph tags. Thank you, everyone.
1.txt=Photoshop\r2025

 

var AB1 = File("C:/Users/Administrator/Desktop/1.txt");
AB1.open("r");
var AB1sz1 = AB1.read();
app.activeDocument.activeLayer.textItem.contents = AB1sz1;

 

 

TOPICS
Actions and scripting
451
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 1 Correct answer

Community Expert , Jan 17, 2025 Jan 17, 2025

It works for me without any problems.

Before

pixxxelschubser_0-1737173221837.png

After

pixxxelschubser_1-1737173341058.png

 

Translate
Adobe
Contributor ,
Jan 17, 2025 Jan 17, 2025

1.jpg2.jpg

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 ,
Jan 17, 2025 Jan 17, 2025

Try

 

1.txt = Photoshop%u000d2025

 

and change the last line to:

app.activeDocument.activeLayer.textItem.contents = unescape(AB1sz1)

 

untested, sent from mobile phone

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
Contributor ,
Jan 17, 2025 Jan 17, 2025
var AB1 = File("C:/Users/Administrator/Desktop/1.txt");
AB1.open("r");
var AB1sz1 = AB1.read();
app.activeDocument.activeLayer.textItem.contents = unescape(AB1sz1);

Sorry, it still doesn't work. Are there any other methods? Thank you.

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 ,
Jan 17, 2025 Jan 17, 2025

It works for me without any problems.

Before

pixxxelschubser_0-1737173221837.png

After

pixxxelschubser_1-1737173341058.png

 

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
Contributor ,
Jan 17, 2025 Jan 17, 2025

I’m very sorry, I forgot to change it to this symbol: %u000d in the text. Thank you, I really appreciate it. It works now. You’re truly awesome!

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 ,
Jan 17, 2025 Jan 17, 2025
LATEST

I already suspected that.
😉
I'm glad it's working for you now.

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