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
-
1What 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.)? – Janus Bahs Jacquet Aug 16 '20 at 7:07
Add a comment
|
/* 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);
}