The script uses a pre-created psd file, imports it into the program(ps) and draws data from user input variables
to populate pre-made text layers within the psd file, then it merges all visible layers save for the background and transforms that to
fit within the bounds of the desired area. The problem is, sometimes the string is too long and ends up
being larger than the canvas. when a function is then called to resize the layer to fit within the bounds of the document, the
unvisible pixels are deleted. I would also love for you guys to tell me what i'm doing wrong when transforming(resizing) the layer,
because its supposed to become 5.5" x 1.25" and its not doing that :\
Thank you!
function resizeLayer(){
if(!documents.length) return;
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var res= doc.resolution;
var LB = activeDocument.activeLayer.bounds;
var Width= LB[2].value - LB[0].value;
var onePix = 100/Width;
var newSize = onePix * 1100;
var newHSize = onePix * 250;
doc.activeLayer.resize( newSize , newHSize, AnchorPosition.MIDDLECENTER);
app.preferences.rulerUnits = startRulerUnits;
}
________________________________________________
function PopulatePlate(){
editplate();
var 1NameLayer = activeDocument.artLayers.getByName("1");
if(1NameLayer.kind == LayerKind.TEXT) companyLayer.textItem.contents = 1Name;
var 2NameLayer = activeDocument.artLayers.getByName("2");
if(2NameLayer.kind == LayerKind.TEXT) pubLayer.textItem.contents = "Featured in:"+ 2Name;
var 3NameLayer = activeDocument.artLayers.getByName("3");
if(3NameLayer.kind == LayerKind.TEXT) dateLayer.textItem.contents = 3Name;
selectLayer("Background");
app.activeDocument.activeLayer.visible = false
selectLayer("1");
app.activeDocument.mergeVisibleLayers();
selectLayer("Background");
app.activeDocument.activeLayer.visible = true
var textLayer = activeDocument.artLayers.getByName("1");
selectLayer("1");
resizeLayer();
app.activeDocument.flatten();
if (TrimColorV === "s" ||TrimColorV === "b" ||TrimColorV === "as"){app.doAction('DesaturatePlate','Layouts0.3')}
app.activeDocument.save();
//app.activeDocument.close();
app.activeDocument = app.documents[0]
app.activeDocument.mergeVisibleLayers() ;
}