• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Aug 15, 2020 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

334

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Aug 16, 2020 Aug 16, 2020

Try the following

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

-Manan

Votes

Translate

Translate
Community Expert ,
Aug 16, 2020 Aug 16, 2020

Copy link to clipboard

Copied

Try the following

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

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

LATEST

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 )

Votes

Translate

Translate

Report

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