Answer the question
In order to leave comments, you need to log in
How to change the script for photoshop?
This script does not quite do what I need, but I don’t know how to change it, I didn’t find the necessary literature, if you have the right links, you can share them, I will be very happy about this.
This script only knows how to extract a list of words from a file and throws them into one layer, but it does not know how to scatter these words over different layers and does not set the desired canvas resolution, for example 640 × 960, does not change the font and does not save the result as PNG. Please tell me how to do it? (thanks in advance for your reply)
#target Adobe Photoshop CC
app.bringToFront();
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.INCHES;
app.preferences.typeUnits = TypeUnits.POINTS;
var docRef = app.documents.add(7, 5, 72);
app.displayDialogs = DialogModes.NO;
var textColor = new SolidColor;
textColor.rgb.red = 255;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;
<b>var myFile = File('/c/script/text.txt');</b>
if (myFile.exists == true){
myFile.open('r', undefined, undefined)
var line;
while(!myFile.eof)
{
line = myFile.readln();
createText(line);
}
myFile.close();
} else {
new File(myFile);
}
function createText(text){
var newTextLayer = docRef.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = text;
newTextLayer.textItem.position = Array(0.75, 0.75);
newTextLayer.textItem.size = 36;
newTextLayer.textItem.font = "Meiryo";
newTextLayer.textItem.color = textColor;
}
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
docRef = null;
textColor = null;
newTextLayer = null
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question