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

Move Paragraph(s) Up/Down

Return to Member Forum

  • Author
    Posts
    • #55968

      Two little scripts that might come in handy: move the current paragraph (or paragraphs) before the previous or after the next one, mimicking Word style high speed-editing. It does not function inside tables, though. (Yet? Who knows.)

      (Instructions on how to install are here: https://creativepro.com/how…..design.php — and when properly installed, don't forget you can add hot keys to scripts too!)

      //DESCRIPTION:Move to Previous Paragraph

      // Jongware, 9-Jun-2010
      if (app.selection.length == 0 || !(app.selection[0].hasOwnProperty (“baseline”)))
      {
      alert (“No text selection — bye.”);
      } else
      {
      p = app.selection[0];
      src = p.parentStory.texts.itemByRange (p.paragraphs[0].texts[0], p.paragraphs.lastItem().texts[0]);
      dst = p.parentStory.paragraphs.previousItem(src.paragraphs[0]);
      if (dst != null)
      src = src.move (LocationOptions.BEFORE, dst);
      app.select(src);
      }

      and its twin bro

      //DESCRIPTION:Move to Next Paragraph

      // Jongware, 9-Jun-2010
      if (app.selection.length == 0 || !(app.selection[0].hasOwnProperty (“baseline”)))
      {
      alert (“No text selection — bye.”);
      } else
      {
      p = app.selection[0];
      src = p.parentStory.texts.itemByRange (p.paragraphs[0].texts[0], p.paragraphs.lastItem().texts[0]);
      dst = p.parentStory.paragraphs.nextItem(src.paragraphs.lastItem());
      if (dst != null)
      src = src.move (LocationOptions.AFTER, dst);
      app.select(src);
      }

      Theoretically, nothing ought to happen with an invalid selection or command (i.e., attempting to move before the first paragraph — fun little jokes like that).

    • #55969
      Anonymous
      Inactive

      Hey thanks, Jongware! Never knew I needed it, but I can certainly see the use for it to make the work flow yet that little faster. :)

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Forum Ads