Hi! When text is selected, app.selection[0] is a Text object, so you can get its first paragraph directly:
var sel = app.selection[0];
if (sel instanceof Text && sel.paragraphs.length > 0) {
var pStyle = sel.paragraphs[0].appliedParagraphStyle;
$.writeln("Style: " + pStyle.name);
$.writeln("Leading: " + pStyle.leading);
}
A couple of notes:
- sel.paragraphs[0] is the paragraph containing the start of the selection — this works even if the selection starts mid-paragraph or is just an insertion point.
- ParagraphStyle.leading gives you the leading defined in the style: either a point value (e.g. "14.4 pt") or Leading.AUTO when the style uses auto-leading. If it's auto and you need the effective value, read pStyle.autoLeading (the percentage) and multiply it by the type size.
- If the user selects a whole text frame instead of text, use sel.parentStory.paragraphs[0].appliedParagraphStyle instead.
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
No account yet? Create an account
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

