3 Replies Latest reply on Jan 27, 2012 3:34 AM by John Hawkinson

    Working around the frame selection order issue in CS 4

    maphiom Level 1

      Hi guys,

       

      I'm trying to write a javascript in Indesign that will copy the contents of every selected text frame into the clipboard. The main problem is the selection order, since I'm using CS 4. I'm trying to work around the problem by writing the X and Y coordinates of every frame in arrays through a "for" loop, since the relevant order is always from top left to bottom right in my documents. However, I'm not sure what to do after sorting the arrays : how could I tell the program to use first the frame with the coordinates closest to 0, then the next, etc. ? So far I have this :

       

       

      var LesX = new Array();

      var LesY = new Array();

      var Blocs = app.selection;

       

      for (var i = 0; i < Blocs.length; i++) {

         

      var myBounds = Blocs[i].geometricBounds;

      var X = myBounds[1];

      var Y = myBounds[0];

      LesX.push(X);

      LesY.push(Y);

       

          }

       

      LesX.sort(sortnum);

       

      Thanks a lot for your help!

       

      Ma