Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Advanced Data Merge question

Return to Forums

  • Author
    Posts
    • #63634
      thenewbeat
      Member

      Hello, I'm trying to faze out our numbering machine here in the print shop. I've been using InDesign's data merge feature to number tickets and single page invoices with great results, so far. The next step is creating multi-part NCR forms, for example:

      Page 1 has two numbers (0001 & 0002). Page 2 needs to also have the same number (0001 & 0002). Then pages 3 and 4 would have the next set (0003 & 0004).

      Is this possible?

    • #63635
      Anonymous
      Inactive

      I have run into this on occasion as well. There doesn't seem to be a clean way to do this in data merge, as it really only knows one page-one record or one page-multiple records. It can't backtrack in the data file and repeat records. The only way to get data merge to do this is to create the spreadsheet with the duplicate numbers in the correct order (1,2,1,2,3,4,3,4,5,6,5,6…).

      What I usually end up doing is doing the mail merge once, then using the pages panel, duplicating each page manually. It is tedious, but unless you have more than a hundred pages to do, or you do this so regularly that it is too time consuming, it is likely the easiest way.

      Certainly, you could write a script that does the page duplication for you. This is a pretty straightforward script. You could even have it handle three-part forms as well.

      This is the code I wrote a few months ago to do a similar function and swap two colums of items across center. You would not need the “Select all items” section at the bottom.

      /* Duplicate page and swap nametag elements across vertical center. By Jake Overton

      Assumptions:

      Inches is the default measurement

      US Letter sized paper in portrait mode

      2 columns of 4″ wide name tags centered on the page and .25″ margins (common border at 4.25″)

      Document is open (error if not) and all nametags are ready for print (text wrap and overset is done)

      */

      main()

      function main(){

      //Make certain that user interaction (display of dialogs, etc.) is turned on.

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

      if (app.documents.length == 0){

      alert(“Please open a document, and try again.”);

      }

      duplicate();

      }

      function duplicate(){

      // Start with last page, duplicate then move back one page. Repeat until at beginning.

      var myDocument = app.activeDocument;

      var myWindow = app.activeWindow;

      var myPages = myDocument.pages;

      for (pageCounter=myPages.length; pageCounter > 0; pageCounter–) {

      myWindow.activePage = myPages[pageCounter-1];

      // Duplicate all items

      var myDuplicate = myWindow.activePage;

      myWindow.activePage.duplicate(LocationOptions.AFTER, myDuplicate);

      // Select all items

      var mySelection = myDuplicate.allPageItems;

      // Swap items based on location of left edge

      // (assume 4″ is dividing line, as some text frames may extend beyond paper center).

      for (i=0; i<=mySelection.length-1; i++){

      //~ $.writeln(“i= “, i,” Type= “, mySelection[i]);

      //~ $.writeln(mySelection[i].geometricBounds);

      if (mySelection[i].constructor.name != “Image”){

      if (mySelection[i].geometricBounds[1] >= 4)

      mySelection[i].move(undefined, [-4,0]);

      else

      mySelection[i].move(undefined, [4,0]);

      }

      }

      }

      }

    • #63650
      thenewbeat
      Member

      Thanks for the ensight on the data file. I had tried to use Excel to perform a more complicated number data file, but ran into a dead end there.

      I do have a lot of PHP experience, so I decided to go that route. here's my script:

      $total_numbers = 10;

      $start_number = 1;

      $numbers_per_page = 2;

      $pages_per_set = 4;

      $fill = 4;

      $tn = 1;

      while ($tn <= ($total_numbers/$numbers_per_page))

      {

      $pps = 1;

      while ($pps <= $pages_per_set)

      {

      $npp = 1;

      if ($pps <= $pages_per_set)

      {

      $print_number = $start_number;

      }

      while ($npp <= $numbers_per_page)

      {

      $print_number_length = strlen($print_number);

      $print_number_fill = ($fill – $print_number_length);

      for( $i=0; $i<$print_number_fill; $i++ )

      {

      $zeros = $zeros.'0';

      }

      echo “$zeros$print_numbern”;

      $print_number++;

      $npp++;

      unset($zeros);

      }

      $pps++;

      }

      $tn++;

      $start_number = ($start_number+$numbers_per_page);

      }

      I hope this helps someone!

    • #103915

      I know this is well out of date now but when I was printing duplicate or triplicate NCR books and I would set the data merge to output once, then on the printer you would set it to print 2 or 3 copies and uncollate the output. That would force the printer to print 2/3 copies of 100 in a row then move on to 099 then 098. You just have to have precollated NCR paper and have your ordering reversed. So if you wanted white>yellow>pink and you would print pink>yellow>white.

Viewing 3 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads