Adobe | Photoshop Code
// Main function function main() { if (app.documents.length == 0) { alert("Please open or create a document first."); return; } var doc = app.activeDocument; // Create a new text layer var textLayer = doc.artLayers.add(); textLayer.kind = LayerKind.TEXT; // Get the text item var textItem = textLayer.textItem; // Set text content textItem.contents = "Hello, Photoshop!\nThis is a script-generated text."; // Font settings textItem.font = "ArialMT"; // Use PostScript name textItem.size = 48; textItem.color = new SolidColor(); textItem.color.rgb.red = 255; textItem.color.rgb.green = 0; textItem.color.rgb.blue = 0; // Alignment and position textItem.justification = Justification.CENTER; textItem.position = [doc.width.value / 2, doc.height.value / 2]; // Optional: add stroke/outline // textItem.strokeEnabled = true; // textItem.strokeColor = new SolidColor(); // textItem.strokeColor.rgb.hexValue = "000000"; // Refresh doc.selection.deselect(); alert("Text layer created successfully!"); }
var fonts = app.fonts; for (var i = 0; i < fonts.length; i++) { $.writeln(fonts[i].name); } Would you like a more advanced example (e.g., paragraph text, layer effects, or batch processing)? adobe photoshop code
// Photoshop Script: Create Styled Text Layer // Save as .jsx file and run via File > Scripts > Browse // Main function function main() { if (app