Copy link to clipboard
Copied
In Extendscript, how do I change the width and height of a text layer separately? I know about changing the font size but that is more generalized, I want specific changes in the width and/or height.
I used Scriptlistener to get some code. When the original width is 14.5 inches and height is 6 inches, then increasing one of width or height by 0.1 inches performs a horizontal or vertical offset of 3.6000 (which I assume is pixels):
var idTrnf = charIDToTypeID( "Trnf" );
var desc231 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1.putEnumerated( idLyr, idOrdn, idTrgt );
desc231.putReference( idnull, ref1 );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc231.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc232 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idRlt = charIDToTypeID( "#Rlt" );
desc232.putUnitDouble( idHrzn, idRlt, 3.600000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idRlt = charIDToTypeID( "#Rlt" );
desc232.putUnitDouble( idVrtc, idRlt, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc231.putObject( idOfst, idOfst, desc232 );
var idWdth = charIDToTypeID( "Wdth" );
var idPrc = charIDToTypeID( "#Prc" );
desc231.putUnitDouble( idWdth, idPrc, 100.689655 );
var idIntr = charIDToTypeID( "Intr" );
var idIntp = charIDToTypeID( "Intp" );
var idBcbc = charIDToTypeID( "Bcbc" );
desc231.putEnumerated( idIntr, idIntp, idBcbc );
executeAction( idTrnf, desc231, DialogModes.NO );
I do not know how this 3.6000 is being calculated. Maybe if I find out about the logic behind this, then I can write some code
Copy link to clipboard
Copied
What is the image’s resolution (Image > Image Size)?
Copy link to clipboard
Copied
Do you want to change the layer bounds or the TextItem size?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now