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

How to create a line in the footer that looks like grows in InDesign?

New Here ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

I am looking to create a line in my footer that looks like the "grows" with each page of the document. So for example the first page it starts at a lenth of 1 and the second page it would be a 2 so on and so forth.

I have been able to create this by manually drawing the line and adjusting it with each page however I was wondering if anyone has ever done this with some level of automation? 

It would be ideal if I had a parent page set up and ID automatically adjusted the size of the line based on the total document length and the current page number. 

 

<Title renamed by moderator>

TOPICS
Experiment , How to

Views

960

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 2 Correct answers

Community Expert , Jun 13, 2023 Jun 13, 2023

I can't think of any automatic - built in - way to do this. 

 

But it's easily scriptable - either by duplicating some object from page to page and make it longer - or override object from MasterSpread and then set its length based on the page's index.

 

I'm not JS guy so can't give you working code. 

 

Votes

Translate

Translate
Community Expert , Jun 13, 2023 Jun 13, 2023

Well, ok, "a line in the footer" doesn't have to be a footnote-separator rule. But that's how I interpreted it.

Votes

Translate

Translate
Community Expert ,
Jul 06, 2023 Jul 06, 2023

Copy link to clipboard

Copied

Clever! Though the page marker is a marker that the font doesn't see as a number. You'd have to use a text frame and use a script to place the page number (or document offset) in there. Also, you need a conversion number: page 50 in a 100-page file and page 5 in a 10-page document should get the same length bar, but won't.

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 ,
Jul 06, 2023 Jul 06, 2023

Copy link to clipboard

Copied

LATEST

I thought I should put my idea to the test. Here's a script, a sample document is attached.

There's one requirement: the footer lines should be named 'Progress line' on the Layers panel:

 

PeterKahrel_0-1688628522766.png

 

A nice enhancement would be to place a lighter-shade bar behind the progress bar so it's easier to see how much there's left to go.

 

(function () {
    
  var indd = app.documents[0];
  var pages = indd.pages.everyItem().getElements();
  var rule;
  var gb;
  var step;


  function stepValue () {
    var r = indd.masterSpreads.everyItem()
            .graphicLines.everyItem().getElements();
    for (var i = 0; i < r.length; i++) {
      if (r[i].name === 'Progress line') {
        var b = r[i].geometricBounds;
        return (b[3] - b[1]) / (indd.pages.length-1);
      }
    }
    return null;
  }

  //--------------------------------------
  // If there's a rule on the page, return it.
  // Otherwise, try to override one.
  
  function getRule (page) {
    var r = page.graphicLines.item ('Progress line');
    if (r.isValid) {
      return r;
    }
    var m = page.masterPageItems;
    for (var i = 0; i < m.length; i++) {
      if (m[i].name === 'Progress line') {
        return m[i].override (page);
      }
    }
    return null;
  }
        
  //==================================================
  
  step = stepValue();

  if (!stepValue) {
    alert ('The document lacks a rule named "Progress line"');
    exit();
  }

  for (var i = 0; i < pages.length; i++) {
    rule = getRule (pages[i]);
    if (rule) {
      gb = rule.geometricBounds;
      rule.geometricBounds = [gb[0], gb[1], gb[2], gb[1]+(i*step)];
    }
  }

}());

 

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