how get paragraph style and character style of selected text in indesign by script

Community Beginner ,
Aug 15, 2020

Copy link to clipboard

Copied

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?

TOPICS
How to, Performance, Publish online, Scripting

Views

82

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Aug 16, 2020
Manan Joshi Adobe Community Professional , Aug 16, 2020
Try the following alert(app.selection[0].appliedParagraphStyle.name) alert(app.selection[0].appliedCharacterStyle.name) -Manan

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Aug 16, 2020

Copy link to clipboard

Copied

Try the following

alert(app.selection[0].appliedParagraphStyle.name)
alert(app.selection[0].appliedCharacterStyle.name)

-Manan

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Aug 18, 2020

Copy link to clipboard

Copied

Hi tabalvor_andisheh,

it's getting more complicate depending what exactly is selected.

 

There could be more than one character style applied to selected text. You could loop the array of textStyleRanges.

If you selected text that belongs to two or more paragraphs you need to test for all paragraphs in your selection to get a possible range of applied paragraph styles.

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more