🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9235

Make Total Pages a Mulitple of a Certain Number

#9235
From: jeffsese
Date: Thu, 07 Sep 2006 07:53
48 lines
2784 bytes
Hi,

I have a several InDesign files that are in a novel/pocketbook format and I need to adjust the total number of pages so that it is a multiple of either 32, 16, or 8 (depends on the type of book).

In order to adjust the total pages, I can either adjust the leading of paragraphs with a specific paragraph style, or if the difference of the leading and font size is greater than or equal to 2 then i will adjust the font.

To change the settings i do a global search and replace, searching all paragraph with the specified style and changing the leading or font size thus overriding the original style. After that if the story overflows, i add pages or if the story has empty pages at the end, i delete them and then remap the master pages.

heres a part of my code:

function addPages(numPages) {
  while((modValue != 0) && (changeValue >= 0.001)) {
    var diff = bodyTextStyleLeading - bodyTextStylePtSze;
    if (diff >= 2) {
      increaseSettings(0, 0.1);
      ptSizeChanged = true;
      leadingChanged = false;
    }
    else {
      increaseSettings(changeValue, 0);
      ptSizeChanged = false;
      leadingChanged = true;
    }
    totalPages = myDoc.pages.length;
    if (totalPages > numPages) {
      if (ptSizeChanged) {
	decreaseSettings(0, 0.1);
      } else {
	decreaseSettings(changeValue, 0);
      }
      totalPages = myDoc.pages.length;
      changeValue = changeValue/10;
    }
    modValue = totalPages%pageMultiple;
  }
}

numPages is the new number of pages i want to achieve.

increaseSettings(agr1, arg2) will increase the leading with an additional arg1 and increase the fontsize with an additional arg2.

decreaseSettings(agr1, arg2) will decrease the leading with less arg1 and decrease the fontsize with less arg2.

Is there a way to improve my script so that i can atleast adjust the pages to the nearest new total pages? My script has a problem when on the first trial of adjustment the new total pages is greater than the desired total.

I hope someone can help me with this....

-- jeff
Technical Details
Message-ID: <3bc18ce8.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!ecngs!feeder.ecngs.de!newsfeed.freenet.de!news.albasani.net!news.buerger.net!open-news-network.org!news.isoc.lu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,66438f339a623ebf,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: jeffsese@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!ecngs!feeder.ecngs.de!newsfeed.freenet.de!news.albasani.net!news.buerger.net!open-news-network.org!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Make Total Pages a Mulitple of a Certain Number
Message-ID: <3bc18ce8.-1@webcrossing.la2eafNXanI>
Date: Thu, 7 Sep 2006 00:53:22 -0700
Lines: 62
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit