Script to find Text Frame By Paragraph Style

New Here ,
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

180

Likes

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

Adobe Community Professional , 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...

Likes

Translate

Translate
Adobe Community Professional ,
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){}
}

 

Likes

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 ,
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.

Likes

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