Getting a list of text out of PS7 using Javascript

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Guest

Getting a list of text out of PS7 using Javascript

Post by Guest »

I have a JS file that analyses various things about a PSD file. The report it gives is longer than 4 lines, and so can't be printed using Alert.

Is there any way I can either:

a) print a list of text items longer than 4 lines to the screen
b) save out a text file

It has to be PS7 and it has to be JS, unfortunately.

Thanks for any help you can give.
Guest

Getting a list of text out of PS7 using Javascript

Post by Guest »

Typically, just after posting this question I fixed the bug that was making it look like I couldn't save out text files. So I can do b).

For future reference, I wouldn't mind finding out about a) though, if anyone has some advice.
Andrew

Getting a list of text out of PS7 using Javascript

Post by Andrew »

I don't use PS 7 so can't help much. In CS alert will print many lines. Also in CS you can use multi-line edit text to print out lots of info. Can PS7 write files, and execuite files - if so you could write to an external document and open the document.I think working with PS7 is a pretty big obstacle.

Andrew
Larry Ligon

Getting a list of text out of PS7 using Javascript

Post by Larry Ligon »

Use the newline string at the end of each line.

Code: Select allalert("This is the first line" + "\n" +
        "This is the second line"+  "\n" );

This works in all versions of Phtoshop scripting.

Larry
Guest

Getting a list of text out of PS7 using Javascript

Post by Guest »

Larry,

That's what I tried first but the Alert box only shows the first four lines.

I got round it by writing out a text file, the only problem was, I couldn't get it to auto-execute Notepad, that has to be done manually.

Thanks for your comments, anyway.
xbytor

Getting a list of text out of PS7 using Javascript

Post by xbytor »

I've acquired the habit of using '\r\n' for alerts, TextItems and other parts of PS because for some of them it has to be a '\r', which ends up causing problems for me in other places if I don't have a '\n';