Scripts in Photoshop
There is such functionality poorly studied by designers in Photoshop as scripts.
Many people use Actions, but to write real jsx scripts you need at least basic knowledge in JS, VBS or AppleScript.
Imagine such a task as creating 50 unique graphic headers for a site, overall style, color, size, but, alas, with different content.
How to solve the problem?
1) Sit down and use the pens to adjust 50 headings, copying text from the text box, adjusting the size and saving the files.
2) Create a script :) I
give the source code of the script below (for editing, a convenient ExtendScript Toolbox is supplied with the photoshop): What does the script do:
It reads the text.txt file line by line and for each line creates a separate text layer in the file containing the value of the line.
We save this with the .jsx extension, create C: /script/text.txt and cheers, a lot has been simplified :)
Many people use Actions, but to write real jsx scripts you need at least basic knowledge in JS, VBS or AppleScript.
Imagine such a task as creating 50 unique graphic headers for a site, overall style, color, size, but, alas, with different content.
How to solve the problem?
1) Sit down and use the pens to adjust 50 headings, copying text from the text box, adjusting the size and saving the files.
2) Create a script :) I
give the source code of the script below (for editing, a convenient ExtendScript Toolbox is supplied with the photoshop): What does the script do:
#target photoshop
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;
var myFile = File('/c/script/text.txt');
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 = "Verdana";
newTextLayer.textItem.color = textColor;
}
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
docRef = null;
textColor = null;
newTextLayer = null;
It reads the text.txt file line by line and for each line creates a separate text layer in the file containing the value of the line.
We save this with the .jsx extension, create C: /script/text.txt and cheers, a lot has been simplified :)