Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Find the maxi height of the rectangle on a page

$
0
0

Hi Forum,

 

Your help is much appreciated.

 

I would like to check the rectangle which is the tallest of all, on each and every page, and write it in a txt file.

 

Here is my try. I can write only the first page rectangle height.

 

writeData();

function writeData (aData ) 

            tt= [];

    myFile = new File("/Users/astudio/Desktop/Info/rectangle.txt");

    if( myFile!='' ) 

    {  

        //Open the file for writing.  

        myResult = myFile.open( 'w', undefined, undefined );  

    } 

       

rct  = app.activeDocument.pages.everyItem().rectangles.everyItem().getElements();

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

rcc =     rct[i].rectangles.everyItem().getElements()

tt.push((rct[i].geometricBounds[2]-rct[i].geometricBounds[0]));

var myarray = tt;

var tf = myarray.sort(SortLowToHigh).pop();

myFile.writeln(rct[i].geometricBounds[2]-rct[i].geometricBounds[0]);     

function SortLowToHigh(a, b)  {

if (a > b) return 1;

else if (a < b) return -1;

else return 0;

}

myFile.close();  

continue;                /// I can't able to write the maximum height of the rectangle for next next pages..... one below the other in Text file.

    }  

}

 

Please help me out to get this done.

 

thanks very much.


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>