10 Replies Latest reply on May 15, 2011 4:54 AM by Colin Flashman

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

    Colin Flashman Adobe Community Professional

      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.

        • 1. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
          Haakenlid Level 3

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

          • 2. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
            [Jongware] Most Valuable Participant

            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.

            1 person found this helpful
            • 3. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
              Colin Flashman Adobe Community Professional

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

              • 4. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                John Hawkinson Level 5
                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.

                1 person found this helpful
                • 5. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                  Colin Flashman Adobe Community Professional

                  @ John Hawkinson

                   

                  your suggestion is SOOOOOO close... but still trying to iron it out.

                   

                  by adjusting line 134 to be

                   

                   

                  myAdjustPage(myPage, myEvenX*myPageValue, 0);
                  

                   

                  and line 138 to be

                   

                  myAdjustPage(myPage, myOddX*myPageValue, 0);
                  

                   

                  the pages do move incrementally... but not how i'd hoped. I'm still keeping the myEvenX and myOddX so that I can type the creep figure into the UI.

                   

                  instead of pages 1 & 2 staying where they were and pages 3 & 4 moving the one incremental value as input in the UI, what happens is page 1 stays where it is, but page 2 moves in by one increment, page 3 moves in by two increments, page 4 by three increments etc... What am I missing here?

                   

                  I have been adjusting these lines in the script since and am getting interesting results, but not the results that I need as illustrated in the last paragraph.

                   

                  as I said in my earlier post, i've devised a javascript to calculate the creep increments, but haven't been able to upload the file anywhere. I can however cut and paste the "engine" of it here:

                   

                  var leaves = (form.pages.value * 1) / 4
                  var creepdecimal = leaves * (form.thickness.value * 1)
                  var leavestomove = leaves - 1
                  var movedecimal = creepdecimal / leavestomove
                    form.creep.value = creepdecimal.toFixed(3)
                    form.move.value = movedecimal.toFixed(3)
                  

                   

                  so the actual HTML calculator simply asks for the amount of pages (with an extra javascript to ensure only amounts divisble by four are entered) and the thickness. Once submitted, the calculator returns the overall creep value and then the page increment value.

                   

                  apart from that, it'll be a winner... at least until the centre spread. I did originally think "I'm not too worried about making the script so it magically works on reverse from the centre of the book, i can just tell the script to run from pages 1-X and then run the script again from X-End using reversed values" but i can't do that because the pages after the centre of the book wouldn't have gone anywhere, and simply running the same script again with reversed values wouldn't work.

                  • 6. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                    John Hawkinson Level 5
                    instead of pages 1 & 2 staying where they were and pages 3 & 4 moving the one incremental value as input in the UI, what happens is page 1 stays where it is, but page 2 moves in by one increment, page 3 moves in by two increments, page 4 by three increments etc... What am I missing here?

                     

                    First of all, the clearest way to debug this is to put "print" statements in the code so you can see what happens. In ExtendScript, that is $.writeln().

                    For instance:

                     

                     

                    $.writeln("myAdjustPage of page "+myPage.name+" myEX "+myEvenX+
                      " mPV"+myPageValue+" => "+
                      myEvenX*myPageValue);
                    

                     

                    The output will appear in the ESTK console.

                     

                    In this case, without testing, it sounds like myPageValue starts counting at zero. So instead try subtracting one from it, like

                     

                    myAdjustPage(myPage, myEvenX*(myPageValue-1), 0);
                    

                     

                    And of course, you're not dividing by two, so you're going to have a problem as well. Perhaps you should subtract 2 from the even pages and 1 from the odd pages. I'm sure you'll figure it out!

                     

                    as I said in my earlier post, i've devised a javascript to calculate the creep increments, but haven't been able to upload the file anywhere. I can however cut and paste the "engine" of it here:

                     

                    var leaves = (form.pages.value * 1) / 4
                    var creepdecimal = leaves * (form.thickness.value * 1)
                    var leavestomove = leaves - 1
                    var movedecimal = creepdecimal / leavestomove
                      form.creep.value = creepdecimal.toFixed(3)
                      form.move.value = movedecimal.toFixed(3)
                    

                     

                    so the actual HTML calculator simply asks for the amount of pages (with an extra javascript to ensure only amounts divisble by four are entered) and the thickness. Once submitted, the calculator returns the overall creep value and then the page increment value.

                    Well, it certainly seems like you can throw this into the AdjustLayout script without too much difficulty, and then use the calculated value in the call to myAdjustPage().

                     

                    or whatever works for you. if you're just doing this once it doesn't need to be bulletproof.

                    • 7. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                      Colin Flashman Adobe Community Professional

                      @ John

                       

                      thank you very much for your help so far, it has been invaluable.

                       

                      rather than use the ESTK, i've been using textwrangler to modify the existing javascript. i thought i'd come up with an answer and had replaced line 134 (as well as the other line) with the following:

                       

                                  myAdjustPage(myPage, ((((myEndPageName/4)-1)-(Math.floor(((myPage-(myEndPageName/2)-0.5)/2))))*(myEvenX/((myEndPageName/4)-1))), myEvenY);
                      

                       

                      but then i get the following error.

                       

                      Screen shot 2011-05-13 at 9.33.28 PM.png

                      the formula that i came up with for line 134 was based on a creep calculator which a poster on a separate forum made available to its users. i've attached a link to it here.

                       

                      ideally, i'd like to have this script in my "toolbox" in case of the rare event that a job like the one in my opening post comes up again, but as I said in my reply to Jongware, just setting the nudge to the creep increment and going page by page will work as well.

                       

                      many thanks,

                       

                      colin

                      • 8. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                        John Hawkinson Level 5
                        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.

                        • 9. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                          Haakenlid Level 3

                          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[n];
                                    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.

                          • 10. Re: [CS3-CS5|JS] is there a script to apply creep to artwork?
                            Colin Flashman Adobe Community Professional

                            @Haakenlid

                             

                            that is FANTASTIC. thank you for that - it works as hoped!!!

                             

                            it's okay that it won't move elements on the master page. at the stage i receive the files the artwork is finished art so overriding master pages will be okay to do.

                             

                            @John Hawkinson

                             

                            alright, i'll use the ESTK. i'm used to writing HTML-based javascripts in plain text editors.

                             

                            thank you everyone for your help with this issue.

                             

                            colin