-2

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.)? – Janus Bahs Jacquet Aug 16 at 7:07
0
/* 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);
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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