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

Using Script to Apply ParagraphStyle

Guest
Oct 03, 2011 Oct 03, 2011

Copy link to clipboard

Copied

I'm using a script to apply a style that formats the text in an active document...such as the font style and size and it indents the first line of every paragraph.

When I run this script it only applies the style on the first paragraph and stops.

Here is the script:

var myDocument = app.activeDocument;

var myParagraphStyle = myDocument.paragraphStyles.item("My Paragraph Style");

myDocument.pages.item(0).textFrames.item(0).paragraphs.item(0).appliedParagraphStyle = myParagraphStyle;

Thank you in advance for any help on this.

TOPICS
Scripting

Views

492

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
People's Champ ,
Oct 03, 2011 Oct 03, 2011

Copy link to clipboard

Copied

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
Advocate ,
Oct 03, 2011 Oct 03, 2011

Copy link to clipboard

Copied

LATEST

Hi North,

Try this below JS Code.

var myDoc = app.activeDocument;

myDoc.pages[0].textFrames[0].paragraphs[0].appliedParagraphStyle = myDoc.paragraphStyles.itemByName("My P Style");

thx

csm_phil

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