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: xbytor, DavideBarranca, Paul MR

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

get text layer properties via Action manager

Postby Alex_the_Cat » Fri Dec 01, 2017 7:09 am

hi!
how to get text layer properties with Action manager?
need text bounds, text origin, font etc
thnx



wasfiwasfi
Posts: 31
Joined: Fri Nov 04, 2016 8:29 am

Re: get text layer properties via Action manager

Postby wasfiwasfi » Sun Dec 03, 2017 7:30 pm

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: 35
Joined: Tue Dec 27, 2016 7:22 pm
Contact:

Re: get text layer properties via Action manager

Postby Jaroslav Bereza » Sun Dec 03, 2017 9:02 pm

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

Examples are changing text properties.
Magic Scripts for Photoshop


Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 3 guests