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

Different Intends at same Paragraphstyles

New Here ,
Apr 05, 2017 Apr 05, 2017

Copy link to clipboard

Copied

Hello.

My problem is the following:

I have a text with headlines, sublines, copytext etc.

All elements are assigned with paragraphstyles.

The copytext has an intend in the first line.

My problem is, how can I automate/grep it, that every first paragraph has NO intend in the first line.

Example:

HEADLINE

COPY NO INTEND TEXT TEXT

TEXT TEXT TEXT.

      INTEND TEXT TEXT TEXT

TEXT TEXT TEXT TEXT.

      INTEND TEXT TEXT TEXT

TEXT TEXT TEXT TEXT.

COPY NO INTEND TEXT TEXT

TEXT TEXT TEXT.

      INTEND TEXT TEXT TEXT

TEXT TEXT TEXT TEXT.

      INTEND TEXT TEXT TEXT

TEXT TEXT TEXT TEXT.

Thank you.

TOPICS
Scripting

Views

488

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
New Here ,
Apr 05, 2017 Apr 05, 2017

Copy link to clipboard

Copied

This is, how it should look like.

Bildschirmfoto 2017-04-05 um 21.42.44.png

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
Engaged ,
Apr 05, 2017 Apr 05, 2017

Copy link to clipboard

Copied

Hi,

Try this code:

var myDoc=app.documents[0];

// list your Head levels

app.findTextPreferences = null; 

app.findTextPreferences.appliedParagraphStyle = app.documents[0].paragraphStyles.item("H1"); // change your head style

list = app.documents[0].findText(0); 

// For each found item 

for (i=0; i<list.length; i++) 

// a. Check the *next* paragraph for your body text 

if (list.paragraphs.nextItem(list.paragraphs[0]).appliedParagraphStyle == app.documents[0].paragraphStyles.item("para"))  // change your paragraph style

// b. If so, remove indent 

  list.paragraphs.nextItem(list.paragraphs[0]).firstLineIndent = 0; 

Thanks,

Prabu

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

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
LEGEND ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

Hi Prabu!

Nice! Personal use:

var myDoc = app.activeDocument; 

app.findGrepPreferences = null;   

app.findGrepPreferences.appliedParagraphStyle = "H1";

myFound = myDoc.findGrep();

var F = myFound.length;

for ( var f = 0; f < F; f++ ) {

    var myNext = myFound.paragraphs.nextItem( myFound.paragraphs[0] );

    if ( myNext.isValid && myNext.appliedParagraphStyle.name == "Para" ) {

        myFound.paragraphs.nextItem( myFound.paragraphs[0] ).firstLineIndent = 0;

    }

}

Note the modification on line 08! 

(^/)

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
Engaged ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

Hi Obi,

Thanks a lot for helping me...

It will help and motivate the new beginners and developers.

Thanks

Prabu

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

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
New Here ,
Apr 09, 2017 Apr 09, 2017

Copy link to clipboard

Copied

LATEST

Hello together and thanks to all of you. it works ...

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