4 Replies Latest reply on Jan 27, 2012 6:56 PM by LinusWang

    How to sort text frames in "Z" order (top left to bottom right)

    LinusWang

      When I export all the text frames out to txt format, I usually use the rorohiko.com plugin "TextStitch", which could make the text thread into 1 in order from top left to bottom right.

      I wonder how to sort the text frames in that order, I can only sort the selected objects vertically, but cannot add in the consideration of horizontal direction.

       

       

      var obj = app.selection;

      if(obj.length<2)

          exit();

      for (var i=0; i<obj.length-1; i++){

          for (var j=i+1; j<obj.length; j++){

              if (obj[i].visibleBounds[0]>obj[j].visibleBounds[0]){

                  temp=obj[i];

                  obj[i]=obj[j];

                  obj[j]=temp;

                  }

              }

      }