I want the selected text to be displayed to me when I select a word or text in InDesign by executing the style paragraph script and its style character?

  • 1
    What do you mean exactly by “displayed”? Alerted in an alert box that you have to click ‘Ok’ to get rid of? What do you expect it to do if you select text with multiple styles applied? Or if you select something that’s not text (a table, an image, a graphics frame, etc.)? Aug 16, 2020 at 7:07

1 Answer 1

/* check if the text cursor is inside some text first */

if (app.selection.length == 1 && app.selection[0].hasOwnProperty("baseline"))

 alert (app.activeDocument.selection[0].appliedParagraphStyle.name);

 alert (app.activeDocument.selection[0].appliedCharacterStyle.name);
} else {

 alert (app.activeDocument.textDefaults.appliedParagraphStyle.name);
 alert (app.activeDocument.textDefaults.appliedCharacterStyle.name);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.