file info( or text doc) to text layer

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

fotoeros

file info( or text doc) to text layer

Post by fotoeros »

I was wondering if it is possible?
I have a stack of images of mushrooms with 3 text layers
1- common name of mushroom
2-Latin name
3-Location

I would like to know if it is possible to read the file info " description" the above 3 line text and copy an paste each line to a specific text layer,
or would it be better to prepare a text file including file name to look up and the 3 text lines

Thanks for any input

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

pattesdours

file info( or text doc) to text layer

Post by pattesdours »

Since I'm not sure exactly what you mean, I would ask for additional details here. Maybe an example of what you have, and what you'd like to obtain?
Mike Hale

file info( or text doc) to text layer

Post by Mike Hale »

If I understand what you want this should be close
Code: Select allvar doc = app.activeDocument;
// get the mushroom info from the document's description metadata
// and create an array with an element for each line
var infoArray = doc.info.caption.split(/[\r\n]/);
// now use layer names to change the text contents
doc.artLayers.getByName('Common').textItem.contents = infoArray[0];
doc.artLayers.getByName('Latin').textItem.contents = infoArray[1];
doc.artLayers.getByName('Location').textItem.contents = infoArray[2];