Page 1 of 1

get text layer properties via Action manager

Posted: Fri Dec 01, 2017 7:09 am
by Alex_the_Cat
hi!
how to get text layer properties with Action manager?
need text bounds, text origin, font etc
thnx

Re: get text layer properties via Action manager

Posted: Sun Dec 03, 2017 7:30 pm
by wasfiwasfi
Hi
make sure the layer in question is selected

Code: Select all

 aL = app.activeDocument.activeLayer;

if(aL.kind == LayerKind.TEXT) {
aLname = aL.name;
aLbounds = aL.bounds;
aLWidth = aL.bounds[2]-aL.bounds[0];
aLHeight = aL.bounds[3]-aL.bounds[1];
aLpostScriptFontName = aL.textItem.font;
aLFontSize = aL.textItem.size;
aLtextContent = aL.textItem.contents;

alert('Layer name: '+aLname+'\n'+
'Layer Bounds: '+aLbounds+'\n'+
'Layer width: '+aLWidth+'\n'+
'Layer height: '+aLHeight+'\n'+
'Font`s Postscript name : '+aLpostScriptFontName+'\n'+
'Font size (in the actual used unit): '+aLFontSize+'\n'+
'Text content: '+aLtextContent);
};

Re: get text layer properties via Action manager

Posted: Sun Dec 03, 2017 9:02 pm
by Jaroslav Bereza
Hi, check my tool: https://github.com/jardicc/ActionManagerHumanizer

Examples are changing text properties.