get text layer properties via Action manager

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Alex_the_Cat
Posts: 1
Joined: Fri Dec 01, 2017 6:53 am

get text layer properties via Action manager

Post by Alex_the_Cat »

hi!
how to get text layer properties with Action manager?
need text bounds, text origin, font etc
thnx
wasfiwasfi
Posts: 45
Joined: Fri Nov 04, 2016 8:29 am

Re: get text layer properties via Action manager

Post 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);
};
User avatar
Jaroslav Bereza
Posts: 38
Joined: Tue Dec 27, 2016 7:22 pm

Re: get text layer properties via Action manager

Post by Jaroslav Bereza »

Hi, check my tool: https://github.com/jardicc/ActionManagerHumanizer

Examples are changing text properties.