June 14 2008 • 1:01 AM

Swap Two Items on Your InDesign Page

Ray asked:

I’m wondering if there’s a way to swap two objects on a page without clicking and dragging to resituate them on the page?

I originally responded to Ray with a “sorry, no.” But then a little script caught my eye! Marc Autret (a.k.a. Amar Cutter) posted a little script on his French site BlogNot! called SwapItems. I wonder if you can guess from its name what the script does?

You may have seen a mention of Marc in our post on scripts, as he also wrote a cool script for making indexes based on a list of words. But not everyone needs indexes! Some of us just need to swap objects around, and this script makes it really easy.

For example, you may have one image on the pasteboard and one on the page, but you’re not sure which you want to use. Just swap them back and forth until you like what you see.

There is no user interface; you simply double-click on the script in the Scripts panel (Window > Automation > Scripts) and whatever two objects are currently selected get swapped on the page.

If the two objects are of different size, you can control which handle coordinate is swapped by first selecting it in the Reference Point proxy thing on the left side of the Control panel. For example, if the lower-left corner is selected, then SwapItems will move the two objects, putting the lower-left corner of one where the lower-left corner of the other one was.

8 Responses discussing this post. Add yours below.

  1. June 14th, 2008 • 8:16 am • Link

    Marc is one of the most incredible scripter on the planet. Not only he programs super extra advanced scripts but when he posts them on his website he explains the whole process with compelling informations and screenshots.

    Sadly it is only in French but click on a few scripts on his website and you’ll understand why a lot of French speaking users of InDesign can’t do anymore without his scripts.

    http://marcautret.free.fr/geek/indd/

  2. June 14th, 2008 • 1:00 pm • Link

    Very cool little script.

    As for the sight being in French, Babblefish does a reasonable job of translating full web pages by just plugging in the URL.

    It’s not perfect but it’s definitely good enough to get the idea.

  3. David Blatner
    June 14th, 2008 • 1:06 pm • Link

    Merci, Branislav! I had meant to put Marc’s main URL for scripts in the post, but had forgotten.

    As Bob says, it’s not hard to get a translation of the pages using Google, though (as Anne-Marie pointed out in the podcast), the results are sometimes as entertaining as they are useful.

  4. Martin Braun
    June 15th, 2008 • 9:58 am • Link

    Give this a try:

    1. Select the two objects
    2. Flip horizontal (by clicking the icon in the control panel)
    3. Flip vertical
    4. Chose Object > Transform Again > Transform Sequence Again Individually

  5. David Blatner
    June 15th, 2008 • 10:34 pm • Link

    Very clever, Martin! I like it. The script has the added benefit of saying where on the objects it should align. But your would work for many instances.

  6. me
    June 18th, 2008 • 8:52 pm • Link
  7. July 2nd, 2008 • 10:55 am • Link

    Thank you! This script is a huge time & sanity saver.

  8. Seth Tipton
    November 11th, 2009 • 1:00 pm • Link

    Great script. I noticed that if a text box varies in size, when I swap, I get alignment issues. Is it set to align to the center of the object? Is there a way for it to align to the top left corner of the box so that when I swap two text boxes of different dimensions it will always keep the alignments?

Subscribe to the Discussion

Get the ongoing discussion surrounding "Swap Two Items on Your InDesign Page" delivered to you. Click here to subscribe via RSS.

Leave a Reply

You can use limited HTML tags, such as <em></em> for emphasis/italics and <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .

InDesignSecrets reserves the right to edit and/or remove posts and comments.