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

Numbered list in reverse

Return to Member Forum

  • Author
    Posts
    • #54973
      Pointyhat
      Member

      Hi, is there anyway to create a numbered list in reverse, ie. 10, 9, 8, etc.?

      Thanks very much for any help!

    • #54976
      David Blatner
      Keymaster

      None that I can think of… that is, no automatically. Script, perhaps?

    • #54977

      By script: sure! This was a bit of fun.

      Place your text cursor into your numbered list as it is now, and be sure to place it inside the first numbered paragraph that should be changed. This script scans to the end of the current list, then reverses the list, putting the first number (which may not be '1'!) into the last item and counting down as it goes up to where you started the script.

      (Copy, paste into a plain text editor — Notepad, Textedit in plain text mode; best is Adobe's own ESTK Editor –, save as “ReverseNumberedList.jsx” into your User Scripts folder; it should automatically appear in the Scripts panel.)

      if (app.selection.length == 0 || !(app.selection[0] instanceof InsertionPoint))
      {
      alert (“Please place the text cursor in the first paragraph with a numbered list…”);
      exit(0);
      }
      firstp = app.selection[0].paragraphs[0];
      if (firstp == null || firstp.bulletsAndNumberingListType != ListType.NUMBERED_LIST)
      {
      alert (“That's not a numbered list…”);
      exit(0);
      }
      lastp = firstp;
      while (lastp.paragraphs.nextItem(lastp) != null && lastp.paragraphs.nextItem(lastp).bulletsAndNumberingListType == ListType.NUMBERED_LIST)
      lastp = lastp.paragraphs.nextItem(lastp);

      // Reached the end of this numbered list. So…
      var count = firstp.numberingResultNumber;
      do
      {
      lastp.properties = ({numberingContinue:false, numberingStartAt:count});
      count++;
      if (lastp == firstp)
      break;
      lastp = lastp.paragraphs.previousItem(lastp);
      } while (1);

    • #55003
      Pointyhat
      Member

      Wow, thanks so much. I'm right in the middle of a deadly deadline, but I'll let you know how it worked out.

    • #55038
      Pointyhat
      Member

      I thought I had several pages of Top Ten lists in reverse but it was in actuallity only the first three. Some of the kids at the Layers forum tried the script and said it worked great. Thanks you so very much!!!

    • #14394217
      Stefan Maier
      Participant

      Hi there this just produced syntax errors for me … is there a version that still works with the newest version of Indesign

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