Home > HOT Posts!, InDesign Scripts > Selection order is back in CS5.5!

Selection order is back in CS5.5!

When I started scripting, about a year ago, I was really frustrated that app.selection didn’t returned correct selection order I used while selecting objects, instead, it returned sorted selection by object ID’s. To make things even worse, just few versions back, app.selection DID returned correct selection order! So, somebody messed things really bad! 😦

Few people did some workarounds, but they were based on top to bottom and/or left to right selection structure. Also, I think that APID ToolAssistant by Rorohiko is able to return correct order of selected objects, but I’m not quite sure.

BUT, I’m really happy to say that this bug is fixed in CS5.5! I was really excited when I found it working like it should! I felt young again! 😀 It opens so many doors for doing some cool automation things! So, I had put together a simple document and did few tests.

Test script:

        var p = [];
        for(var i = 0; i < app.selection.length; i++)
            p.push("Object: " + app.selection[i].toSource() + " | Contents: " + app.selection[i].contents)
        return p;
    }().join('\r'), "Adobe InDesign ver. (" + app.version + ")"


Horizontal order:

Red line represents selection order.


Vertical order:

Red line represents selection order.


Notice how order of object ID change between horizontal and vertical selection order! This is really awesome! Thank you Adobe for fixing this!

Now, all you need to do is to wait till CS5.5 hit the market! 😉

  1. liviu
    May 3, 2011 at 13:51

    Excellent! This means a script for aligning objects in a similar way with coreldraw is possible (align relative to last object in selection, which is a better way in my opinion).

  2. August 29, 2012 at 15:50

    This is really an excellent script for indesign. I wish this site was still more active.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: