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.
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.
https://marcautret.free.fr/geek/indd/
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.
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.
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
Hi Martin, this was very useful. Is there a script to replicate above sequence. Much appreciated, learning a lot by browsing these aricles!
Swapimages i have used but it doesnt seem to work with newer versions of Indesign. Perhaps its me :) But your step by step worked very well.
Best regards,
Niklas
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.
the whole site translated
Thank you! This script is a huge time & sanity saver.
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?
Thanks a ton, I downloaded your swapitems.js script into InDesign CS5 for Mac and it worked beautifully. Saved me a ton of time on this particular job.
Can anyone help please! I installed this script to swap objects and it worked perfectly the first time, and then the COMMAND + CLICK function which selects multiple objects failed.
COMMAND + CLICK still works in all my other programs including Photoshop, and on my Mac desktop but NOT in Indesign.
Any suggestions?
Thanks
@bronwenstephens: In InDesign, Command-click is a way to select “through” one object to another object behind. To select more than one object, use Shift-click. I don’t think the script had anything to do with the shortcut.
Thank you David – I figured that out after going around in circles for a while – got myself confused with Photoshop commands and though Shift+Click did sequential objects only. Thanks for clarifying. The script is working absolutely fine – a great time saver!
This website doesn’t seem to exist anymore. Has this script moved to a new location? If not, is there another alternative? A plugin/extension for ID that includes that function of swapping items position. I’d actually pay for it if available (free is always nice as well). Any help is appreciated.
I believe you can find the script here: https://www.indiscripts.com/post/2009/10/indiscripts-temporary-archives