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

Adding Column Rules to multiple connected text frames

Community Beginner ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

Hi

I have a multi-page document with a single text frame split into two columns on each page. I would like to place a column rule on every page. I have set up an Object Style that will do this. Is there any way I can apply that style to all of my pages, not just one at a time?

TOPICS
How to

Views

321

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

Advisor , Nov 28, 2022 Nov 28, 2022

Hello @J5FC1,

 

Give this script a try, just change "Test" to the name of your Object Style...

 

function main() {
  doc = app.documents[0];

    for(var i=0;i<doc.pages.length;i++){
       var myPageItems = doc.pageItems.everyItem().getElements();
        for(var i=0;i<myPageItems.length;i++){
           if (myPageItems[i] instanceof TextFrame){
              myPageItems[i].applyObjectStyle(doc.objectStyles.itemByName("Test"));
           }
       }
    }
}
app.doScript(main, ScriptLanguage.JAVASCR
...

Votes

Translate

Translate
Advisor ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

Hello @J5FC1,

 

Give this script a try, just change "Test" to the name of your Object Style...

 

function main() {
  doc = app.documents[0];

    for(var i=0;i<doc.pages.length;i++){
       var myPageItems = doc.pageItems.everyItem().getElements();
        for(var i=0;i<myPageItems.length;i++){
           if (myPageItems[i] instanceof TextFrame){
              myPageItems[i].applyObjectStyle(doc.objectStyles.itemByName("Test"));
           }
       }
    }
}
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Do Script');

 

 

You can also try this free script "Apply Object Style to All Text Containers in a Story"

https://www.id-extras.com/apply-object-style-to-all-text-containers-in-a-story-free-script/

 

Regards,

Mike

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 Beginner ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

Thanks Mike. I wasn't able to get your script to work, but the "Apply Object Style to All Text Containers in a Story" has done the trick. 

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 ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

Work with primary textframes. You can put such one with this text frame object style on the master/parent. Apply this master/parent to the pages where you need this style.

If you don not work with primary text frames it will not work.

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 Beginner ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

LATEST

Thanks Willi,

I've not used Primary Text Frames before, but can see the value for future projects

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