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

Script to find Text Frame By Paragraph Style

Explorer ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Hy guys, please someone should help me with a script to do this.

 

I want to find a text frame with paragraph style “CASES”  across my documents of more than 500 pages, then change the text frame vertical alignment option to “center”.

 

I.e. 

From This

1.PNG

To This

2.PNG

Thanks

 

 

{Renamed by MOD}

TOPICS
Scripting

Views

623

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 , May 07, 2021 May 07, 2021

Is there anything about the frame you can search for via Object settings, using the Find Object dialog box? 

 

If not, rudimentarily (Change 'P Style Name to Find' to the paragraph style name in question): 

var tfs = app.activeDocument.textFrames.everyItem().getElements();
for (var i = 0; i < tfs.length; i++) {
    try { 
        if (tfs[i].insertionPoints[0].appliedParagraphStyle.name == "P Style Name to Find") { 
            tfs[i].textFramePreferences.verticalJustification = VerticalJustifica
...

Votes

Translate

Translate
Community Expert ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Is there anything about the frame you can search for via Object settings, using the Find Object dialog box? 

 

If not, rudimentarily (Change 'P Style Name to Find' to the paragraph style name in question): 

var tfs = app.activeDocument.textFrames.everyItem().getElements();
for (var i = 0; i < tfs.length; i++) {
    try { 
        if (tfs[i].insertionPoints[0].appliedParagraphStyle.name == "P Style Name to Find") { 
            tfs[i].textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
        }
    } catch(e){}
}

 

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
Explorer ,
May 08, 2021 May 08, 2021

Copy link to clipboard

Copied

LATEST

Wooow,

It worked perfectly well just like magic. Everything happened in 3 seconds.

Really appreciate bro.

Am seriously excited.

Thanks you.

Thank you

Thank you.

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