Skip to main content
Colin Flashman
Community Expert
April 29, 2011
Answered

[CS3-CS5|JS] is there a script to apply creep to artwork?

  • April 29, 2011
  • 2 replies
  • 3391 views

I work for a commercial printer and we have RIP software which, when requested, applies creep to impositions. it literally pushes the pages in the imposition closer to the spine in increments of the total creep calculation.

Out of curiosity more than anything else, has a script like this been made to apply creep directly to indesign native files? If not, how difficult would it be to adjust the default "adjustlayout.jsx" script to instruct it to behave this way?

Message was edited by: cdflash did find a link to an iphone app: http://boundlessideas.com/creepcalc/index.html don't know if it works though as i don't have an iphone 😞 . also sounds like it simply adds guides which reflect the creep, rather than shifting the content. this all came about after a DL portrait saddle-stitched print job came in with a running footer which was a swash-like crossover on every page, so creep could not be applied using the RIP (as the pages were closer to the centre spread the swash lined up less and less). instead, all content EXCEPT the running footer had to be crept in page by page in different increments for each page.

This topic has been closed for replies.
Correct answer
rather than use the ESTK, i've been using textwrangler to modify the existing javascript.

Unless you are an expert, you really must use the ESTK to debug. Access to $.writeln() is essential, as is the ability to single-step and to query variables at runtime.

Feel free to use whatever text editor to author stuff, but until your done you should run it in the ESTK. (Even if you are an expert, giving up the ESTK's debugging functionality is probably a serious mistake.)

Anyhow, obviously your formula is resulting in NaN, or not-a-number. Perhaps you are dividing by zero.

Run your script under the ESTK.

Print out the values of your variables in the Console when it crashes.

Or use $.writeln() and print them out every time and look at them and see when they diverge from your expectations.

The former is better for finding a specific problem. The latter is better for making sure they all make sense.

Use the ESTK, Colin!

(Also boldface.)

Remember, it stands for (the Empire Strikes TextwranKler!). Cue Darth Vader music.


Here's a suggestion for a creep script:

var creepPerSheet = 0.1; // default value. Set it to whatever value you want.
var myDoc = app.activeDocument;
var report = "creep\n(positive values = rightwards, negative = leftwards)\n";
var numberOfPages = myDoc.pages.length;

if (numberOfPages%4 != 0){
     alert ("Error\nThis document has "+numberOfPages+" pages.\nDocument has to have pages divisable by 4");
} else {
     creepPerSheet = prompt("Give amount in current horizontal measurement units" ,creepPerSheet,"How much creep per sheet?")
     var numberOfSheets = numberOfPages/4;
     var sheetNumber = 0;
     myDoc.pageItems.everyItem().locked = false;
     myDoc.layers.everyItem().locked = false;
     for (var n = 0; n < numberOfPages; n++){
          myPage = myDoc.pages;
          sheetNumber = (numberOfPages / 2 - (1 + Math.abs(1 + n-n%2-numberOfPages/2))) / 2
          creepamount = sheetNumber * (n%2 == 1? creepPerSheet: - creepPerSheet);
          myPage.pageItems.everyItem().move(null,[creepamount,0]);
          report += "\npage "+myPage.name+": "+creepamount;
     }
     alert (report);
}

However it will not move elements on master pages, and there will also be problems with elements that spans both pages of a spread.

2 replies

Jongware
Community Expert
May 11, 2011

Of course this is possible (theoretically), but the hapless users would need to be *VERY* careful with this. Creep depends on lots of things; notably, the binding order, way of stapling/folding/glueing, and exact thickness of paper. Stapled magazines (booklet style) have different parameters than perfect bound books -- and so on. Without the proper background knowlegde, it'd be downright disastrous to use.

I think it's unwise to pursue a pure InDesign solution for this.

Colin Flashman
Community Expert
May 12, 2011

@ Haakenlid

the adjustlayout.jsx script will move selected pages the same amount. the creep script i have in mind will move pages in increments. for example, a 32pp saddle stitch book with a total creep value of 1.12mm will need an incremental move of .16mm every two pages. in other words, pages 1 & 2 won't move, but pages 3&4 will move .16mm towards the spine, then pages 5&6 will move .32mm towards the spine, then pages 7&8 will move .48mm towards the spine etc until the centre spread, and then the increments work in reverse.

@ Jongware

completely agree. It isn't a script i'd encourage designers to use, but rather it would be for prepress operators like myself in the very rare circumstances that I outlined in my opening post. I've devised an HTML-based javascript calculator to work out the total creep value and increment per leaf value based on page count and paper thickness, but my knowledge of javascript is elementary so making a script to apply the increments is something which has stumped me. the only script which is similar is adjustlayout.jsx but as mentioned, that will move selected paged the same amount rather than incrementally until the centre spread.

I suppose the "poor man" solution of setting indesign's nudge to be the increment, and then going through page by page moving the artwork manually works too oh well...

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
John Hawkinson
Inspiring
May 12, 2011
very rare circumstances that I outlined in my opening post. I've devised an HTML-based javascript calculator to work out the total creep value and increment per leaf value based on page count and paper thickness, but my knowledge of javascript is elementary so making a script to apply the increments is something which has stumped me. the only script which is similar is adjustlayout.jsx but as mentioned, that will move selected paged the same amount rather than incrementally until the centre spread.

It doesn't seem like you need more than an elementary knowledge of Javascript to change AdjustLayout.jsx. Surely you've looked at it. The workhorse section seems to be lines 129-140:

for(var myCounter = (myStartPage.documentOffset-1); myCounter < myEndPage.documentOffset; myCounter++){
    myPage = app.activeDocument.pages.item(myCounter);
    var myPageValue = myPage.documentOffset;
    myPageValue = myPageValue + myPageAdjust;
    if(myPageValue % 2 == 0){
        //Page is an even page.
        myAdjustPage(myPage, myEvenX, myEvenY);
        }
    else{
        //Page is an odd page.
        myAdjustPage(myPage, myOddX, myOddY);
    }

}

Anyhow, I'm not sure what your creep expression is, but let's say it is (0.16 mm * (pagenumber/2)). And 0.16 mm is 0.453 points, and the script sets the measurement unit to points.

So, then, make the even page case

myAdjustPage(myPage, 0.0453*(myPageValue/2), 0);

and the same for the odd pge. Now, I gather you need to change the sign midway through, so you can do it with an if, or perhaps something like ((-16+pagenumber)*0.0453) or whatever. Or you could write it with if's. Or you could use a lookup table you generated with a spreadsheet. Or lots of other things.

May 11, 2011

What is the difference between what adjustlayout.jsx does and what you want your creep script to do?